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. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en