[concurrency-interest] Questions about ThreadPoolExecutor

Joe Bowbeer joe.bowbeer at gmail.com
Thu Mar 2 16:27:27 EST 2006

On 3/2/06, Brian Goetz <brian at quiotix.com> wrote:

> I think this, along with the trick above of combining caller-runs
> with SynchronousQueue meets all your requirements.
>      public static ExecutorService exec
>          = Executors.newFixedThreadPool(100);

Note that newFixedThreadPool uses an unbounded queue.

newCachedThreadPool would get you the synchronous queue, but I think
you'll need to invoke one of the ThreadPoolExecutor constructors
yourself regardless, because none of the Executors factory methods
provides everything you need, and you'll need a real
ThreadPoolExecutor in order to configure the queue, maximum pool size,
rejected execution handler, and keep-alive time.

More information about the Concurrency-interest mailing list