For Clojure versions prior to 1.4:
You cannot replace the built-in agent pools for sending and sending threads. They are hardcoded in Agent.java .
The send pool (used for calculation) has a fixed size = 2 + Runtime.getRuntime (). availableProcessors ().
The send pool (also used for futures) is a cached thread pool and will grow without restriction. This allows an arbitrary number of background tasks to wait for I / O. Cached streams will be reused and discarded if they are idle for one minute.
If you want to control the work in your thread pool, you need to plunge into java.util.concurrent or use the Clojure wrapper lib.
For Clojure 1.5 (upcoming):
You can provide your own ExecutorService using (send-through executor af), the default thread pools are no longer rigidly connected. See Agent.java in Clojure 1.5+ for more details.
Alex miller
source share