We run our web application wehre we start some Threads for background work and also Quartz.
When I try to shutdown tomcat(using shell script on linux), I always get the error saying failed to shutdown tomcat due to daemon threads and Quartz threads.
We have tried different ways to shutdown our threads (exit out of run method) but we rely on few static variables of a class to do this which become null by the time my shut down listener gets a callback
Is there a standard approach to shut down tomcat for such a scenario?
And now for the possible answer (if you use Spring), check out this thread. If you use Spring you can add an explicit
destroyclause in your spring config for Quartz so it can shutdown cleanly.Otherwise a Servlet listener (I think the ServletContext listener, but it has been a while…) can detect shutdown and you can manually shutdown Quartz.