[concurrency-interest] ThreadPoolExecutor not shutting down

Dibyendu Majumdar concurrency-interest at majumdar.org.uk
Sat Mar 20 07:59:29 EDT 2010


David, Ben,

Thank you for responding to my query. It turns out that this problem was
because of a bug in my code; one of the pools wasn't being explicitly
shutdown.

The fact that the MAC OS X Tiger version of the concurrency library is so
old did alarm me. But I suppose that unless Apple do something about it, we
have to live with it. As far as I understand, the latest library is
incompatible with Java 5 - am I correct?

Regards

Dibyendu

On 19 March 2010 00:43, David Holmes <davidcholmes at aapt.net.au> wrote:

>  In general a ThreadPoolExecutor must be explicitly shutdown. Your
> application needs to manage the TPE lifecycle. In later JDK versions you can
> use the idle timeout on core threads to let all threads terminate.
>
> A daemon thread factory will prevent the TPE from keeping the VM alive, but
> at the risk of allowing submitted tasks to not be run or to be terminated in
> the midst of execution - generally not a good thing.
>
> A shutdown hook is of little help here as the hooks will only run if the VM
> has decided to shutdown due to no user-threads (which can't be the case due
> to the TPE), or System.exit has been called, in which case there's no need
> to explicitly shutdown the TPE (it's about to get obliterated by process
> termination), unless you want to manage the unfinished tasks.
>
> HTH
>
> David Holmes
>
> -----Original Message-----
> *From:* concurrency-interest-bounces at cs.oswego.edu [mailto:
> concurrency-interest-bounces at cs.oswego.edu]*On Behalf Of *Ben Manes
> *Sent:* Friday, 19 March 2010 10:35 AM
> *To:* Dibyendu Majumdar; concurrency-interest at cs.oswego.edu
> *Subject:* Re: [concurrency-interest] ThreadPoolExecutor not shutting down
>
>  This sounds like you'd want to use daemon thread factory, use a shutdown
> hook to stop the executor, or another approach to let the VM gracefully
> exit.
>
>  ------------------------------
> *From:* Dibyendu Majumdar <concurrency-interest at majumdar.org.uk>
> *To:* concurrency-interest at cs.oswego.edu
> *Sent:* Thu, March 18, 2010 3:05:34 PM
> *Subject:* [concurrency-interest] ThreadPoolExecutor not shutting down
>
> I am running Java 1.5 on Mac OS X Tiger - and I think that the
> ThreadPoolExecutor code is a very old version. The pool is not shutting
> down; by running through the debugger I can see that all idle threads are
> blocked on a queue, and the shutdown sequence does not interrupt idle
> threads.
> Is there any way I can run a more up-to-date version with Java 1.5?
> Is there a known workaround to this issue?
>
> Many thanks
>
> Regards
> Dibyendu
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20100320/d5d493f5/attachment.html>


More information about the Concurrency-interest mailing list