[concurrency-interest] MaximumPoolSize not used with unbounded queues

david gonneau dgonneau at gmail.com
Thu Mar 30 08:19:26 EST 2006


I am using a threadPoolExecutor with a PriorityBlockingQueue (not bounded).

I made the choice of an unbouded queue to be able to resize the queue
dynamically using the setMaxCapacity() without having to kill my executor or
my queue.

I don't see why the MaximumPoolSize wouldn't be used in that case.

If I set 2 thread in the corePool and 5 as maximumPool, only my 2 threads of
the core will be spawned. Then for further tasks coming, as long as the two
first threads are busy, the queue will be used to store the incoming tasks.
Without even trying to spawn new threads as specified on the

Why such a limit ?

Is there any way to bypass this ? Is there a valid reason of not using
temporary threads with an unlimited queue ???

Thanks for ur inputs :)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060330/ed84e474/attachment.html

More information about the Concurrency-interest mailing list