BroadcastJobListener (Quartz Parent POM 2.0.1 API)

Quartz Java



org.quartz.listeners Class BroadcastJobListener

java.lang.Object
  extended by org.quartz.listeners.BroadcastJobListener
All Implemented Interfaces:
JobListener

public class BroadcastJobListener
extends Object
implements JobListener

Holds a List of references to JobListener instances and broadcasts all events to them (in order).

The broadcasting behavior of this listener to delegate listeners may be more convenient than registering all of the listeners directly with the Scheduler, and provides the flexibility of easily changing which listeners get notified.

Author:
James House (jhouse AT revolition DOT net)
See Also:
addListener(org.quartz.JobListener), removeListener(org.quartz.JobListener), removeListener(String)

Constructor Summary
BroadcastJobListener(String name)
          Construct an instance with the given name.
BroadcastJobListener(String name, List<JobListener> listeners)
          Construct an instance with the given name, and List of listeners.
 
Method Summary
 void addListener(JobListener listener)
           
 List<JobListener> getListeners()
           
 String getName()
           Get the name of the JobListener.
 void jobExecutionVetoed(JobExecutionContext context)
           Called by the Scheduler when a JobDetail was about to be executed (an associated Trigger has occurred), but a TriggerListener vetoed it's execution.
 void jobToBeExecuted(JobExecutionContext context)
           Called by the Scheduler when a JobDetail is about to be executed (an associated Trigger has occurred).
 void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException)
           Called by the Scheduler after a JobDetail has been executed, and be for the associated Trigger's triggered(xx) method has been called.
 boolean removeListener(JobListener listener)
           
 boolean removeListener(String listenerName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BroadcastJobListener

public BroadcastJobListener(String name)
Construct an instance with the given name. (Remember to add some delegate listeners!)

Parameters:
name - the name of this instance


BroadcastJobListener

public BroadcastJobListener(String name,
                            List<JobListener> listeners)
Construct an instance with the given name, and List of listeners.

Parameters:
name - the name of this instance
listeners - the initial List of JobListeners to broadcast to.

Method Detail

getName

public String getName()
Description copied from interface: JobListener

Get the name of the JobListener.

Specified by:
getName in interface JobListener

addListener

public void addListener(JobListener listener)

removeListener

public boolean removeListener(JobListener listener)

removeListener

public boolean removeListener(String listenerName)

getListeners

public List<JobListener> getListeners()

jobToBeExecuted

public void jobToBeExecuted(JobExecutionContext context)
Description copied from interface: JobListener

Called by the Scheduler when a JobDetail is about to be executed (an associated Trigger has occurred).

This method will not be invoked if the execution of the Job was vetoed by a TriggerListener.

Specified by:
jobToBeExecuted in interface JobListener
See Also:
JobListener.jobExecutionVetoed(JobExecutionContext)

jobExecutionVetoed

public void jobExecutionVetoed(JobExecutionContext context)
Description copied from interface: JobListener

Called by the Scheduler when a JobDetail was about to be executed (an associated Trigger has occurred), but a TriggerListener vetoed it's execution.

Specified by:
jobExecutionVetoed in interface JobListener
See Also:
JobListener.jobToBeExecuted(JobExecutionContext)

jobWasExecuted

public void jobWasExecuted(JobExecutionContext context,
                           JobExecutionException jobException)
Description copied from interface: JobListener

Called by the Scheduler after a JobDetail has been executed, and be for the associated Trigger's triggered(xx) method has been called.

Specified by:
jobWasExecuted in interface JobListener


Copyright 2001-2011, Terracotta, Inc.