Managing the SchedulerBesides starting the Scheduler, you might need to perform a few other operations on the Scheduler during your application's lifetime. These Scheduler operations include querying, putting the Scheduler in standby mode, resuming, and stopping. For many situations, when a Scheduler is started, you don't need to do anything except let it run. In certain circumstances, you might need to temporarily halt the Scheduler using the standby mode. Starting the SchedulerStarting the Scheduler couldn't be more straightforward. When you have an instance of a Scheduler that has been properly initialized and your jobs and triggers have been registered, simply call the start() method:
When the start() method is called, the Scheduler starts looking for jobs that need to be executed. You use the start() method when you have a new Scheduler instance and when the Scheduler has been placed into standby mode. After shutdown() has been called, you can no longer call start() on that Scheduler instance.
Standby ModePutting the Scheduler in standby mode causes the Scheduler to temporarily stop looking for jobs to execute. As an example, suppose your Scheduler gets its job information from a database and you need to restart the database. You could either restart Scheduler when the database is back online or just put the Scheduler in standby mode. You can put a Scheduler in standby mode by calling the standby() method: public void standby() throws SchedulerException; In standby mode, the Scheduler does not attempt to execute jobs because the thread that searches for jobs that need executing is paused. Stopping the SchedulerYou can use two versions of the shutdown() method to stop the Scheduler: public void shutdown(boolean waitForJobsToComplete) The only difference between these two methods is that one version takes a Boolean argument that doesn't let the Scheduler stop until all currently executing jobs have finished executing. The shutdown() method without the argument is similar to calling shutdown(false). |
Friday, December 25, 2009
Managing the Scheduler
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment