[concurrency-interest] Questions about ThreadPoolExecutor

Joe Bowbeer joe.bowbeer at gmail.com
Wed Mar 1 20:17:14 EST 2006


On 3/1/06, Kwok, Grace (MSCIBARRA) <Grace.Kwok at mscibarra.com> wrote:
> "You can create a custom Executor for each batch of Callables.  You will
> probably want to use some other bounding mechanism to ensure that
> aggregate number of threads created by such executors doesn't exceed
> some threshold."
>

This could be done by having all of the dedicated executors submit
their work to one master executor.


> If I am to create an Executor for each batch of Callables, the threads
> from Executor 1 could not be reused by threads from Executor 2, is that
> correct?  Is this optimal?  Is this like a pool of Executors?
>

ThreadPoolExecutor per batch seems right to me.  If you want to
cleanup when a batch is done, you can call executorService.shutdown().

You can also call executorService.setKeepAliveTime() so that the idle
threads will self-terminate more or less automatically.



More information about the Concurrency-interest mailing list