Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Quartz TriggerListeners and JobListeners

Related Tutorials


 
 

Share on Google+Share on Google+

TriggerListeners and JobListeners

Advertisement
To perform any action you create Listeners objects and these actions are based on events occurring within the scheduler.

TriggerListeners and JobListeners

     

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.

scheduler.addGlobalJobListener(myJobListener);
or
scheduler.addJobListener(myJobListener);
 

SchedulerListeners

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

Advertisements

If you enjoyed this post then why not add us on Google+? Add us to your Circles



Liked it!  Share this Tutorial


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 13, 2007

Related Tutorials

Discuss: TriggerListeners and JobListeners   View All Comments

Post your Comment


Your Name (*) :
Your Email :
Subject (*):
Your Comment (*):
  Reload Image
 
 
Comments:0
DMCA.com