logo       

Re: Questions about ThreadPoolExecutor and possible loss of 'command': msg#00043

java.jsr.166-concurrency

Subject: Re: Questions about ThreadPoolExecutor and possible loss of 'command'

Joshi, Rahul wrote:


As 'addIfUnderMaximumPoolSize' is private I can not overload 'execute'
method. How do I implement the pool as explained above.

One way to do it is to override beforeExecute and/or afterExecute
to dynamically change core, max, or timeout settings. You can
do something similar with a RejectedExecutionHandler.

Our experience though is that either you want to unboundedly add threads
(i.e., use a bounded queue but unbounded max) or unboundedly add queued
tasks (i.e., use an unbounded queue and bounded max). Other combinations
tend to be less well-behaved.


Also can you answer my second query about possible loss of 'command'?

Notice that the code is in a loop, so it is not lost; instead everything
is retried.

-Doug


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

News | FAQ | advertise