jhouse. : - (.
, ServletContextListener web.xml:
<listener>
<listener-class>org.whatever.MyListener</listener-class>
</listener>
Then in the implementation, in the context of the contextDestroyed () method, sleep for 10 seconds (1 second was not enough for my application). It should look something like this:
public class MyListener implements ServletContextListener {
public void contextInitialized(ServletContextEvent arg0) {}
public void contextDestroyed(ServletContextEvent arg0) {
try {
System.out.println("Sleep for a bit so that we don't get any errors about Quartz threads not being shut down yet. ");
Thread.sleep(10 * 1000);
} catch (Exception e) {
e.printStackTrace();
}
}
}
I did not need to call the scheduler shutdown methods (it was clear that they were already called somewhere, maybe because I use Spring). All I had to do was add the wait, and then they all left (except for the FileWatchdog Log4j stream and some other MySQL stream, but these are different issues).
source
share