[concurrency-interest] Questions about ThreadPoolExecutor

Kwok, Grace (MSCIBARRA) Grace.Kwok at mscibarra.com
Wed Mar 1 15:20:31 EST 2006


Hi,
 
    There are two things I need to achieve for my thread pool.
 
    1)  I need to have the pool customized such when I invokeAll on a
Collection of Callables, I also get to specify how many threads I want
to allocate to run this Collection of Callables.
 
    2) The run() method of the runnable (say A) that I submit to the
pool might create other runnables (say a and b) which will in terms be
submitted to the same pool.  It seems to me that my only choice would be
to use the SynchronousQueue because if I were to use an
ArrayBlockingQueue, it might cause a deadlock.  (Since the runnable a
and b might not be run until A is finished and A can't finish until a
and b are done.  Correct me if I am wrong.)   However, it looks like
using SynchronusQueue requires the pool to be unbounded which I don't
want.  I want a bounded pool.
 
Any suggestion on how I can achieve these two criteria using the 1.5
concurrency Executor.  
 
Thank you very much in advance for your valuable suggestions.
 
Grace
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender.  Sender does not waive confidentiality or privilege, and use is prohibited.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: /pipermail/attachments/20060301/8a9aab67/attachment.html


More information about the Concurrency-interest mailing list