public abstract class AbstractTrigger<T extends Trigger> extends java.lang.Object implements OperableTrigger
The base abstract class to be extended by all Triggers.
Triggers s have a name and group associated with them, which
should uniquely identify them within a single .
Scheduler
Triggers are the 'mechanism' by which Job s
are scheduled. Many Trigger s can point to the same Job,
but a single Trigger can only point to one Job.
Triggers can 'send' parameters/data to Jobs by placing contents
into the JobDataMap on the Trigger.
Trigger.CompletedExecutionInstruction, Trigger.TriggerState, Trigger.TriggerTimeComparatorDEFAULT_PRIORITY, MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY, MISFIRE_INSTRUCTION_SMART_POLICY| Constructor and Description |
|---|
AbstractTrigger()
Create a
Trigger with no specified name, group, or . |
AbstractTrigger(java.lang.String name)
Create a
Trigger with the given name, and default group. |
AbstractTrigger(java.lang.String name,
java.lang.String group)
Create a
Trigger with the given name, and group. |
AbstractTrigger(java.lang.String name,
java.lang.String group,
java.lang.String jobName,
java.lang.String jobGroup)
Create a
Trigger with the given name, and group. |
| Modifier and Type | Method and Description |
|---|---|
java.lang.Object |
clone() |
int |
compareTo(Trigger other)
Compare the next fire time of this
Trigger to that of
another by comparing their keys, or in other words, sorts them
according to the natural (i.e. |
boolean |
equals(java.lang.Object o)
Trigger equality is based upon the equality of the TriggerKey.
|
Trigger.CompletedExecutionInstruction |
executionComplete(JobExecutionContext context,
JobExecutionException result)
This method should not be used by the Quartz client.
|
java.lang.String |
getCalendarName()
Get the name of the
associated with this
Trigger. |
java.lang.String |
getDescription()
Return the description given to the
Trigger instance by
its creator (if any). |
java.lang.String |
getFireInstanceId()
This method should not be used by the Quartz client.
|
java.lang.String |
getFullJobName()
Returns the 'full name' of the
Job that the Trigger
points to, in the format "group.name". |
java.lang.String |
getFullName()
Returns the 'full name' of the
Trigger in the format
"group.name". |
java.lang.String |
getGroup()
Get the group of this
Trigger. |
JobDataMap |
getJobDataMap()
Get the
JobDataMap that is associated with the
Trigger. |
java.lang.String |
getJobGroup()
Get the name of the associated
's
group. |
JobKey |
getJobKey() |
java.lang.String |
getJobName()
Get the name of the associated
. |
TriggerKey |
getKey() |
int |
getMisfireInstruction()
Get the instruction the
Scheduler should be given for
handling misfire situations for this Trigger- the
concrete Trigger type that you are using will have
defined a set of additional MISFIRE_INSTRUCTION_XXX
constants that may be passed to this method. |
java.lang.String |
getName()
Get the name of this
Trigger. |
int |
getPriority()
The priority of a
Trigger acts as a tiebreaker such that if
two Triggers have the same scheduled fire time, then the
one with the higher priority will get first access to a worker
thread. |
abstract ScheduleBuilder<T> |
getScheduleBuilder()
Get a
ScheduleBuilder that is configured to produce a
schedule identical to this trigger's schedule. |
TriggerBuilder<T> |
getTriggerBuilder()
Get a
TriggerBuilder that is configured to produce a
Trigger identical to this one. |
int |
hashCode() |
void |
setCalendarName(java.lang.String calendarName)
Associate the
with the given name with
this Trigger. |
void |
setDescription(java.lang.String description)
Set a description for the
Trigger instance - may be
useful for remembering/displaying the purpose of the trigger, though the
description has no meaning to Quartz. |
void |
setFireInstanceId(java.lang.String id)
This method should not be used by the Quartz client.
|
void |
setGroup(java.lang.String group)
Set the name of this
Trigger. |
void |
setJobDataMap(JobDataMap jobDataMap)
Set the
JobDataMap to be associated with the
Trigger. |
void |
setJobGroup(java.lang.String jobGroup)
Set the name of the associated
's
group. |
void |
setJobKey(JobKey key) |
void |
setJobName(java.lang.String jobName)
Set the name of the associated
. |
void |
setKey(TriggerKey key) |
void |
setMisfireInstruction(int misfireInstruction)
Set the instruction the
Scheduler should be given for
handling misfire situations for this Trigger- the
concrete Trigger type that you are using will have
defined a set of additional MISFIRE_INSTRUCTION_XXX
constants that may be passed to this method. |
void |
setName(java.lang.String name)
Set the name of this
Trigger. |
void |
setPriority(int priority)
The priority of a
Trigger acts as a tie breaker such that if
two Triggers have the same scheduled fire time, then Quartz
will do its best to give the one with the higher priority first access
to a worker thread. |
java.lang.String |
toString()
Return a simple string representation of this object.
|
void |
validate()
Validates whether the properties of the
JobDetail are
valid for submission into a Scheduler. |
protected abstract boolean |
validateMisfireInstruction(int candidateMisfireInstruction) |
finalize, getClass, notify, notifyAll, wait, wait, waitcomputeFirstFireTime, setNextFireTime, setPreviousFireTime, triggered, updateAfterMisfire, updateWithNewCalendarsetEndTime, setStartTimegetEndTime, getFinalFireTime, getFireTimeAfter, getNextFireTime, getPreviousFireTime, getStartTime, mayFireAgainpublic AbstractTrigger()
Create a Trigger with no specified name, group, or .
JobDetail
Note that the setName(String),setGroup(String)and
the setJobName(String)and setJobGroup(String)methods
must be called before the Trigger can be placed into a
Scheduler.
public AbstractTrigger(java.lang.String name)
Create a Trigger with the given name, and default group.
Note that the setJobName(String)and
setJobGroup(String)methods must be called before the Trigger
can be placed into a Scheduler.
java.lang.IllegalArgumentException - if name is null or empty, or the group is an empty string.public AbstractTrigger(java.lang.String name,
java.lang.String group)
Create a Trigger with the given name, and group.
Note that the setJobName(String)and
setJobGroup(String)methods must be called before the Trigger
can be placed into a Scheduler.
group - if null, Scheduler.DEFAULT_GROUP will be used.java.lang.IllegalArgumentException - if name is null or empty, or the group is an empty string.public AbstractTrigger(java.lang.String name,
java.lang.String group,
java.lang.String jobName,
java.lang.String jobGroup)
Create a Trigger with the given name, and group.
group - if null, Scheduler.DEFAULT_GROUP will be used.java.lang.IllegalArgumentException - if name is null or empty, or the group is an empty string.public java.lang.String getName()
Get the name of this Trigger.
public void setName(java.lang.String name)
Set the name of this Trigger.
java.lang.IllegalArgumentException - if name is null or empty.public java.lang.String getGroup()
Get the group of this Trigger.
public void setGroup(java.lang.String group)
Set the name of this Trigger.
group - if null, Scheduler.DEFAULT_GROUP will be used.java.lang.IllegalArgumentException - if group is an empty string.public void setKey(TriggerKey key)
setKey in interface MutableTriggerpublic java.lang.String getJobName()
Get the name of the associated .
JobDetail
public void setJobName(java.lang.String jobName)
Set the name of the associated .
JobDetail
java.lang.IllegalArgumentException - if jobName is null or empty.public java.lang.String getJobGroup()
Get the name of the associated 's
group.
JobDetail
public void setJobGroup(java.lang.String jobGroup)
Set the name of the associated 's
group.
JobDetail
jobGroup - if null, Scheduler.DEFAULT_GROUP will be used.java.lang.IllegalArgumentException - if group is an empty string.public void setJobKey(JobKey key)
setJobKey in interface MutableTriggerpublic java.lang.String getFullName()
Returns the 'full name' of the Trigger in the format
"group.name".
public TriggerKey getKey()
public java.lang.String getFullJobName()
Returns the 'full name' of the Job that the Trigger
points to, in the format "group.name".
public java.lang.String getDescription()
Return the description given to the Trigger instance by
its creator (if any).
getDescription in interface Triggerpublic void setDescription(java.lang.String description)
Set a description for the Trigger instance - may be
useful for remembering/displaying the purpose of the trigger, though the
description has no meaning to Quartz.
setDescription in interface MutableTriggerpublic void setCalendarName(java.lang.String calendarName)
Associate the with the given name with
this Trigger.
Calendar
setCalendarName in interface MutableTriggercalendarName - use null to dis-associate a Calendar.public java.lang.String getCalendarName()
Get the name of the associated with this
Trigger.
Calendar
getCalendarName in interface Triggernull if there is no associated Calendar.public JobDataMap getJobDataMap()
Get the JobDataMap that is associated with the
Trigger.
Changes made to this map during job execution are not re-persisted, and
in fact typically result in an IllegalStateException.
getJobDataMap in interface Triggerpublic void setJobDataMap(JobDataMap jobDataMap)
Set the JobDataMap to be associated with the
Trigger.
setJobDataMap in interface MutableTriggerpublic int getPriority()
Trigger acts as a tiebreaker such that if
two Triggers have the same scheduled fire time, then the
one with the higher priority will get first access to a worker
thread.
If not explicitly set, the default value is 5.
getPriority in interface TriggerTrigger.DEFAULT_PRIORITYpublic void setPriority(int priority)
Trigger acts as a tie breaker such that if
two Triggers have the same scheduled fire time, then Quartz
will do its best to give the one with the higher priority first access
to a worker thread.
If not explicitly set, the default value is 5.
setPriority in interface MutableTriggerTrigger.DEFAULT_PRIORITYpublic Trigger.CompletedExecutionInstruction executionComplete(JobExecutionContext context, JobExecutionException result)
This method should not be used by the Quartz client.
Called after the has executed the
Scheduler associated with the JobDetailTrigger
in order to get the final instruction code from the trigger.
executionComplete in interface OperableTriggercontext - is the JobExecutionContext that was used by the
Job'sexecute(xx) method.result - is the JobExecutionException thrown by the
Job, if any (may be null).Trigger.CompletedExecutionInstruction,
OperableTrigger.triggered(Calendar)public void setMisfireInstruction(int misfireInstruction)
Set the instruction the Scheduler should be given for
handling misfire situations for this Trigger- the
concrete Trigger type that you are using will have
defined a set of additional MISFIRE_INSTRUCTION_XXX
constants that may be passed to this method.
If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.
setMisfireInstruction in interface MutableTriggerTrigger.MISFIRE_INSTRUCTION_SMART_POLICY,
OperableTrigger.updateAfterMisfire(Calendar),
SimpleTrigger,
CronTriggerprotected abstract boolean validateMisfireInstruction(int candidateMisfireInstruction)
public int getMisfireInstruction()
Get the instruction the Scheduler should be given for
handling misfire situations for this Trigger- the
concrete Trigger type that you are using will have
defined a set of additional MISFIRE_INSTRUCTION_XXX
constants that may be passed to this method.
If not explicitly set, the default value is MISFIRE_INSTRUCTION_SMART_POLICY.
getMisfireInstruction in interface TriggerTrigger.MISFIRE_INSTRUCTION_SMART_POLICY,
OperableTrigger.updateAfterMisfire(Calendar),
SimpleTrigger,
CronTriggerpublic void validate()
throws SchedulerException
Validates whether the properties of the JobDetail are
valid for submission into a Scheduler.
validate in interface OperableTriggerjava.lang.IllegalStateException - if a required property (such as Name, Group, Class) is not
set.SchedulerExceptionpublic void setFireInstanceId(java.lang.String id)
This method should not be used by the Quartz client.
Usable by
implementations, in order to facilitate 'recognizing' instances of fired
JobStoreTrigger s as their jobs complete execution.
setFireInstanceId in interface OperableTriggerpublic java.lang.String getFireInstanceId()
This method should not be used by the Quartz client.
getFireInstanceId in interface OperableTriggerpublic java.lang.String toString()
Return a simple string representation of this object.
toString in class java.lang.Objectpublic int compareTo(Trigger other)
Compare the next fire time of this Trigger to that of
another by comparing their keys, or in other words, sorts them
according to the natural (i.e. alphabetical) order of their keys.
public boolean equals(java.lang.Object o)
public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.Object clone()
clone in interface MutableTriggerclone in class java.lang.Objectpublic TriggerBuilder<T> getTriggerBuilder()
TriggerTriggerBuilder that is configured to produce a
Trigger identical to this one.getTriggerBuilder in interface TriggerTrigger.getScheduleBuilder()public abstract ScheduleBuilder<T> getScheduleBuilder()
TriggerScheduleBuilder that is configured to produce a
schedule identical to this trigger's schedule.getScheduleBuilder in interface TriggerTrigger.getTriggerBuilder()Copyright IBM Corp. 2024, 2025