Hey Dennis, I suggested some of the same ideas here (http://tech.puredanger.com/ 2010/06/08/clojure-agent-thread-pools/) and Rich said that these seemed like good suggestions post-1.2. I think allowing you to modify the agent thread pools after construction seems possibly dangerous from a concurrency point of view, but maybe that would be ok.
Alex On Jul 25, 3:47 am, dennis <killme2...@gmail.com> wrote: > 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