tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CBy <>
Subject Re: Tomcat shutdown problem due to running threads.
Date Wed, 17 Jun 2009 14:33:06 GMT
Thanks for pointing me in the right direction André. A 
ServletContextListener fixed my problem.

André Warnier wrote:
> CBy wrote:
>> O'Reilly's Tomcat The Definitive Guide advises me to invoke the 
>> setDaemon(true) method on any Thread object a web application creates 
>> to keep them from hanging the JVM when Tomcat shuts down. My web 
>> service, however, uses a thread pool that is created via 
>> java.util.concurrent.Executors.newFixedThreadPool(NTHREADS) and I 
>> don't know how to make them daemon threads in this case.
>> My new plan was to register a shutdown hook with the JVM in my web 
>> service and to invoke shutdown() or shutdownNow() on the 
>> ExecutorService in it (the method above returns an ExecutorService). 
>> Unfortunately, this does not seem to work.
>> Is there another way to be notified when Tomcat shuts down, so I can 
>> shutdown the thread pool accordingly?
> From a non-expert (but the expterts are mostly asleep right now) :
> maybe this ?
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message