I have Quartz scheduler in my web application with Guice. I followed code found here. Everything works fine, but I can't figure out how to shutdown scheduler. My context listener looks like this:
public class MyAppContextListener extends GuiceServletContextListener{
@Override
protected Injector getInjector() {
return Guice.createInjector(new QuartzModule(), new MyAppServletModule());
}
}
And Quartz module looks like this:
public class QuartzModule extends AbstractModule {
@Override
protected void configure() {
bind(SchedulerFactory.class).to(StdSchedulerFactory.class).in(Scopes.SINGLETON);
bind(GuiceJobFactory.class).in(Scopes.SINGLETON);
bind(Quartz.class).in(Scopes.SINGLETON);
}
What is the best way to shutdown scheduler when application is being stopped or undeployed?