org.quartz.listeners
public class FilterAndBroadcastTriggerListener extends java.lang.Object implements TriggerListener
The broadcasting behavior of this listener to delegate listeners may be more convenient than registering all of the listeners directly with the Trigger, and provides the flexibility of easily changing which listeners get notified.
You may also register a number of Regular Expression patterns to match the events against. If one or more patterns are registered, the broadcast will only take place if the event applies to a trigger who's name/group matches one or more of the patterns.
addListener(org.quartz.TriggerListener)
,
removeListener(org.quartz.TriggerListener)
,
removeListener(String)
,
addTriggerNamePattern(String)
,
addTriggerGroupPattern(String)
Constructor and Description |
---|
FilterAndBroadcastTriggerListener(java.lang.String name)
Construct an instance with the given name.
|
FilterAndBroadcastTriggerListener(java.lang.String name,
java.util.List listeners)
Construct an instance with the given name, and List of listeners.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(TriggerListener listener) |
void |
addTriggerGroupPattern(java.lang.String regularExpression)
If one or more group patterns are specified, only events relating to
triggers who's group matches the given regular expression pattern
will be dispatched to the delegate listeners.
|
void |
addTriggerNamePattern(java.lang.String regularExpression)
If one or more name patterns are specified, only events relating to
triggers who's name matches the given regular expression pattern
will be dispatched to the delegate listeners.
|
java.util.List |
getListeners() |
java.lang.String |
getName()
Get the name of the
TriggerListener . |
java.util.List |
getTriggerGroupPatterns() |
java.util.List |
getTriggerNamePatterns() |
boolean |
removeListener(java.lang.String listenerName) |
boolean |
removeListener(TriggerListener listener) |
protected boolean |
shouldDispatch(Trigger trigger) |
void |
triggerComplete(Trigger trigger,
JobExecutionContext context,
int triggerInstructionCode)
|
void |
triggerFired(Trigger trigger,
JobExecutionContext context)
|
void |
triggerMisfired(Trigger trigger)
|
boolean |
vetoJobExecution(Trigger trigger,
JobExecutionContext context)
|
public FilterAndBroadcastTriggerListener(java.lang.String name)
name
- the name of this instancepublic FilterAndBroadcastTriggerListener(java.lang.String name, java.util.List listeners)
name
- the name of this instancelisteners
- the initial List of TriggerListeners to broadcast to.public java.lang.String getName()
TriggerListener
Get the name of the TriggerListener
.
getName
in interface TriggerListener
public void addListener(TriggerListener listener)
public boolean removeListener(TriggerListener listener)
public boolean removeListener(java.lang.String listenerName)
public java.util.List getListeners()
public void addTriggerNamePattern(java.lang.String regularExpression)
regularExpression
- public java.util.List getTriggerNamePatterns()
public void addTriggerGroupPattern(java.lang.String regularExpression)
regularExpression
- public java.util.List getTriggerGroupPatterns()
protected boolean shouldDispatch(Trigger trigger)
public void triggerFired(Trigger trigger, JobExecutionContext context)
TriggerListener
Called by the
when a Scheduler
has fired, and it's associated Trigger
is about to be executed.
JobDetail
It is called before the vetoJobExecution(..)
method of this
interface.
triggerFired
in interface TriggerListener
trigger
- The Trigger
that has fired.context
- The JobExecutionContext
that will be passed to
the Job
'sexecute(xx)
method.public boolean vetoJobExecution(Trigger trigger, JobExecutionContext context)
TriggerListener
Called by the
when a Scheduler
has fired, and it's associated Trigger
is about to be executed.
JobDetail
It is called after the triggerFired(..)
method of this
interface.
vetoJobExecution
in interface TriggerListener
trigger
- The Trigger
that has fired.context
- The JobExecutionContext
that will be passed to
the Job
'sexecute(xx)
method.public void triggerMisfired(Trigger trigger)
TriggerListener
Called by the
when a Scheduler
has misfired.
Trigger
Consideration should be given to how much time is spent in this method, as it will affect all triggers that are misfiring. If you have lots of triggers misfiring at once, it could be an issue it this method does a lot.
triggerMisfired
in interface TriggerListener
trigger
- The Trigger
that has misfired.public void triggerComplete(Trigger trigger, JobExecutionContext context, int triggerInstructionCode)
TriggerListener
Called by the
when a Scheduler
has fired, it's associated Trigger
has been executed, and it's JobDetail
triggered(xx)
method has been
called.
triggerComplete
in interface TriggerListener
trigger
- The Trigger
that was fired.context
- The JobExecutionContext
that was passed to the
Job
'sexecute(xx)
method.triggerInstructionCode
- the result of the call on the Trigger
'striggered(xx)
method.Copyright © 2014. All Rights Reserved.