public class FilterAndBroadcastJobListener extends Object implements JobListener
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 job who's name/group matches one or more of the patterns.
addListener(org.quartz.JobListener)
,
removeListener(org.quartz.JobListener)
,
removeListener(String)
,
addJobNamePattern(String)
,
addJobGroupPattern(String)
Constructor and Description |
---|
FilterAndBroadcastJobListener(String name)
Construct an instance with the given name.
|
FilterAndBroadcastJobListener(String name,
List listeners)
Construct an instance with the given name, and List of listeners.
|
Modifier and Type | Method and Description |
---|---|
void |
addJobGroupPattern(String regularExpression)
If one or more group patterns are specified, only events relating to
jobs who's group matches the given regular expression pattern
will be dispatched to the delegate listeners.
|
void |
addJobNamePattern(String regularExpression)
If one or more name patterns are specified, only events relating to
jobs who's name matches the given regular expression pattern
will be dispatched to the delegate listeners.
|
void |
addListener(JobListener listener) |
List |
getJobGroupPatterns() |
List |
getJobNamePatterns() |
List |
getListeners() |
String |
getName()
Get the name of the
JobListener . |
void |
jobExecutionVetoed(JobExecutionContext context)
Called by the
when a
was about to be executed (an associated
has occured), but a vetoed it's
execution. |
void |
jobToBeExecuted(JobExecutionContext context)
|
void |
jobWasExecuted(JobExecutionContext context,
JobExecutionException jobException)
|
boolean |
removeListener(JobListener listener) |
boolean |
removeListener(String listenerName) |
protected boolean |
shouldDispatch(JobExecutionContext context) |
public FilterAndBroadcastJobListener(String name)
name
- the name of this instancepublic String getName()
JobListener
Get the name of the JobListener
.
getName
in interface JobListener
public void addListener(JobListener listener)
public boolean removeListener(JobListener listener)
public boolean removeListener(String listenerName)
public List getListeners()
public void addJobNamePattern(String regularExpression)
regularExpression
- public List getJobNamePatterns()
public void addJobGroupPattern(String regularExpression)
regularExpression
- public List getJobGroupPatterns()
protected boolean shouldDispatch(JobExecutionContext context)
public void jobToBeExecuted(JobExecutionContext context)
JobListener
Called by the
when a Scheduler
is about to be executed (an associated JobDetail
has occured).
Trigger
This method will not be invoked if the execution of the Job was vetoed
by a
.
TriggerListener
jobToBeExecuted
in interface JobListener
JobListener.jobExecutionVetoed(JobExecutionContext)
public void jobExecutionVetoed(JobExecutionContext context)
JobListener
Called by the
when a Scheduler
was about to be executed (an associated JobDetail
has occured), but a Trigger
vetoed it's
execution.
TriggerListener
jobExecutionVetoed
in interface JobListener
JobListener.jobToBeExecuted(JobExecutionContext)
public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException)
JobListener
Called by the
after a Scheduler
has been executed, and be for the associated JobDetail
Trigger
's
triggered(xx)
method has been called.
jobWasExecuted
in interface JobListener
Copyright © 2014. All rights reserved.