dennis
unread,Jul 25, 2010, 6:47:24 AM7/25/10Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Clojure
Agent use two thread pools to execute actions,send use a fixed thread
pool (2+cpus threads),and send-off use a cached thread pool.These
pools are global in clojure system.
I think the Agent should allow users to customize the thread pool,
if no custom, then use the global thread pool.
Why do I need a custom thread pool?
First, the default thread pool is global, send use the thread pool
is a fixed size cpus +2, is likely to become the system bottleneck
sometime. Although you can use the send-off, use the cache thread
pool, but in a real world application, I can not use the cache thread
pool, which will introduce the risk of OutOfMemoryError, normally I
like to use a fixed-size thread pool.
Second, the actions which global thread pool execute are from a
variety of agents, the actions are not homogeneous, and can not
maximize the efficient use of the thread pool, we hope that you can
specify different agent to isolate a particular thread pool to
maximize the use of thread pool .
I think Agent could add two new functions:
(set-executor! agent (java.util.concurrent.Executors/
newFixedThreadPool 2))
(shutdown-agent agent)
set-executor! is to set the agent's custom thread pool,and shutdown-
agent to shutdown the agent's custom thread pool.