On Fri, Jun 4, 2010 at 10:11 PM, Gregg Wonderly <[email protected]> wrote:
> I'd have to say no for the existing Executor implementations in the JDK.
>  The concurrency utilities related to Executor in the JDK are tailored for,
> and specifically limited to applications where you have unrelated tasks that
> need to be throttled amongst a limited set of threads.
>
> River's TaskManager will always create more threads, but will prune those
> threads after they sit idle for too long.  We need this behavior to keep
> away from distributed deadlock which can occur anytime another remote
> operation might be the only way that progress can happen in the overall
> processing of a distributed application.
>
> Be very careful where you use j.u.c ThreadPoolExecutor et.al, because of
> their design.  It would be possible to use an appropriate Executor
> implementation, but it would have to behave like TaskManager and always
> create a new thread for new work, when no idle threads are available.

Hi Gregg

This is not how I understood ThreadPoolExecutor, even from the JavaDoc
http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html

"A ThreadPoolExecutor will automatically adjust the pool size (see
getPoolSize()) according to the bounds set by corePoolSize (see
getCorePoolSize()) and maximumPoolSize (see getMaximumPoolSize()).
When a new task is submitted in method execute(java.lang.Runnable),
and fewer than corePoolSize threads are running, a new thread is
created to handle the request, even if other worker threads are idle.
If there are more than corePoolSize but less than maximumPoolSize
threads running, a new thread will be created only if the queue is
full."

and

"f the pool currently has more than corePoolSize threads, excess
threads will be terminated if they have been idle for more than the
keepAliveTime (see getKeepAliveTime(java.util.concurrent.TimeUnit)).
This provides a means of reducing resource consumption when the pool
is not being actively used. If the pool becomes more active later, new
threads will be constructed."

Under what configuration of TPE would we see a problem?

Thanks
Patrick

Reply via email to