public class TomcatStopListener implements ServletContextListener {
public void contextDestroyed(ServletContextEvent arg0) {
// How to get reference of already running Quartz Scheduler here??
}
}
On the stop of tomcat server, I want to stop the quartz scheduler to avoid errors, I know scheduler.shutdown(); but how can i get the reference to the scheduler here?
If you have used
QuartzInitializerServletto initialise your Quartz, then you can do something likeinside your
contextDestroyedmethod, wherectxis your ServletContext.StdSchedulerFactory instance is stored into the ServletContext.
For more information refer to Quartz Initializer Servlet