tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From CBy <>
Subject Tomcat shutdown problem due to running threads.
Date Wed, 17 Jun 2009 08:33:45 GMT
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?

Thanks in advance,


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

View raw message