To perform any action you create Listeners objects and these actions are based on events occurring within the scheduler. TriggerListeners receive events related to triggers, and JobListeners receive events related to jobs.
Events related to Trigger : trigger firings, trigger mis-firings and trigger completions.
Events related to Job : a notification when the job is about to be executed, and a notification that the job has completed execution
For creating listener, simply create an object that implements either the org.quartz.JobListener and/or org.quartz.TriggerListener interface. Then during run time listeners are registered with the scheduler, and must be given a name. Listeners can be registered as either "global" or "non-global". Global listeners receive events for ALL triggers/jobs, and non-global listeners receive events only for the specific triggers/jobs that explicitly name the listener in their getJobListenerNames() or getTriggerListenerNames() properties.
SchedulerListeners are much same as TriggerListeners and JobListeners, but they receive notification of events within the Scheduler itself - its not necessary events related to a specific trigger or job.
Events related to Scheduler : the addition of a job/trigger, the removal of a job/trigger, a serious error within the scheduler, notification of the scheduler being shutdown, and others.
SchedulerListeners are created and registered in the same way as the Trigger & Job Listener, but there is no distinction between global and non-global listeners. SchedulerListeners can be virtually any object that implements the org.quartz.SchedulerListener interface
If you enjoyed this post then why not add us on Google+? Add us to your Circles
Liked it! Share this Tutorial