[concurrency-interest] Thread Pools

Patrick Eger peger at automotive.com
Fri Jul 21 13:02:01 EDT 2006


Hi, I know this has come up again and again, (I think I brought it up
once or twice ;-) But are there any plans to add a
"preferExistingThreads()" to the ThreadPoolExecutor, to address the
issue of dynamic pool sizing, or is there any way I can extend these
classes to do such?

 

IE I would like a:

1) potentially infinite queue of tasks (currently using a
LinkedBlockingQueue)

2) executed by up to MAX threads concurrently

3) which go away after a period of inactivity, allowing the pool to
shrink to MIN (or zero) size

4) preferring to use already existing threads rather than creating new
ones

 

This is currently impossible with the current setup AFAICS; I have
continued to have to use my own thread pools because of this, though I
would love to switch to the standard JUC classes. #3 was covered in JDK
6 with the capability to allow core threads to timeout, but I cannot
find a way to make #4 possible with current JUC. The existing behaviour
will always end up creating CORE threads even though they are
unnecessary to execute existing work.

 

Thanks in advance for any replies.

 

 

Best Regards, 

 

Patrick

-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060721/326e2546/attachment.html 


More information about the Concurrency-interest mailing list