Quartz Scheduler Example Programs and Sample Code : Quartz Code Snippets : How-To: Shut Down a Scheduler
How-To: Shut Down a Scheduler
To shutdown / destroy a scheduler, simply call one of the scheduler’s shutdown( ) methods.
Once you have shutdown a scheduler, it cannot be restarted (as threads and other resources are permanently destroyed). If you simply want to pause a scheduler for a while, use the suspend( ) method.
Wait for Executing Jobs to Finish
//shutdown() does not return until executing Jobs complete execution
scheduler.shutdown(true);
Do Not Wait for Executing Jobs to Finish
//shutdown() returns immediately, but executing Jobs continue running to completion
scheduler.shutdown();
//or
scheduler.shutdown(false);
If you are using the org.quartz.ee.servlet.QuartzInitializerListener to fire up a scheduler in your servlet container, its contextDestroyed() method will shutdown the scheduler when your application is undeployed or the application server shuts down (unless its shutdown-on-unload property has been explicitly set to false).
Copyright © 2010-2015 Software AG, Darmstadt, Germany.

Product Logo |   Feedback