[concurrency-interest] ExecutorCompletionService

Holger Hoffstätte holger at wizards.de
Mon Jan 8 03:32:15 EST 2007

Peter Kovacs wrote:
> I would like to use some kind of ThreadPool executor for execution
> which blocks when the maximum number of threads in the pool is reached
> and all threads are utilized.

As Joe pointed out this existed in the Doug Lea's original concurrent
library, and since I needed it for backwards compatbility I "ported" it
(accidentally for use with the backport lib too):


test case:

Feel free to use it any way you want; if you have questions drop me a line.

That being said, waiting for the pool/queue only works for certain amounts
of work and producer/consumer ratios: if you produce work more quickly
than you consume it over an extended period of time, you will eventually
run out of something, somewhere, unless you throttle.


More information about the Concurrency-interest mailing list