Class AbstractTrigger
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparable<Trigger>
,MutableTrigger
,OperableTrigger
,Trigger
- Direct Known Subclasses:
CronTriggerImpl
,SimpleTriggerImpl
Trigger
s.
Triggers
s have a name and group associated with them, which should uniquely
identify them within a single
.
Scheduler
Trigger
s 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 Job
s by placing contents into the
JobDataMap
on the Trigger
.
- Author:
- James House, Sharada Jambula
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.quartz.triggers.Trigger
Trigger.CompletedExecutionInstruction, Trigger.TriggerTimeComparator
-
Field Summary
Fields inherited from interface org.quartz.triggers.Trigger
DEFAULT_PRIORITY, MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY, MISFIRE_INSTRUCTION_SMART_POLICY
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionclone()
int
Compare the next fire time of thisTrigger
to that of another by comparing their keys, or in other words, sorts them according to the natural (i.e.boolean
Trigger equality is based upon the equality of the Trigger name.executionComplete
(JobExecutionContext context, JobExecutionException result) This method should not be used by the Quartz client.Get the name of the
associated with this Trigger.Calendar
Return the description given to theTrigger
instance by its creator (if any).This method should not be used by the Quartz client.Get theJobDataMap
that is associated with theTrigger
.Get the name of the associated
.JobDetail
int
Get the instruction theScheduler
should be given for handling misfire situations for thisTrigger
- the concreteTrigger
type that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXX
constants that may be set as this property's value.getName()
Get the name of thisTrigger
.int
The priority of aTrigger
acts as a tiebreaker such that if twoTrigger
s have the same scheduled fire time, then the one with the higher priority will get first access to a worker thread.int
hashCode()
void
setCalendarName
(String calendarName) Associate the
with the given name with this Trigger.Calendar
void
setDescription
(String description) Set a description for theTrigger
instance - may be useful for remembering/displaying the purpose of the trigger, though the description has no meaning to Quartz.void
This method should not be used by the Quartz client.void
setJobDataMap
(JobDataMap jobDataMap) Set theJobDataMap
to be associated with theTrigger
.void
setJobName
(String jobName) Set the name of the associated
.JobDetail
void
setMisfireInstruction
(int misfireInstruction) Set the instruction theScheduler
should be given for handling misfire situations for thisTrigger
- the concreteTrigger
type that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXX
constants that may be passed to this method.void
Set the name of thisTrigger
.void
setPriority
(int priority) The priority of aTrigger
acts as a tie breaker such that if twoTrigger
s 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.toString()
void
validate()
Validates whether the properties of theJobDetail
are valid for submission into aScheduler
.protected abstract boolean
validateMisfireInstruction
(int misfireInstruction) Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.quartz.triggers.MutableTrigger
setEndTime, setStartTime
Methods inherited from interface org.quartz.triggers.OperableTrigger
computeFirstFireTime, setNextFireTime, setPreviousFireTime, triggered, updateAfterMisfire
Methods inherited from interface org.quartz.triggers.Trigger
getEndTime, getFinalFireTime, getFireTimeAfter, getNextFireTime, getPreviousFireTime, getStartTime, mayFireAgain
-
Field Details
-
startTime
-
endTime
-
nextFireTime
-
previousFireTime
-
-
Constructor Details
-
AbstractTrigger
public AbstractTrigger()Create aTrigger
with no specified name, group, orJobDetail
Note that the
setName(String)
and thesetJobName(String)
methods must be called before theTrigger
can be placed into aScheduler
.
-
-
Method Details
-
validateMisfireInstruction
protected abstract boolean validateMisfireInstruction(int misfireInstruction) -
getName
Description copied from interface:Trigger
Get the name of thisTrigger
. -
getJobName
Description copied from interface:Trigger
Get the name of the associated
.JobDetail
- Specified by:
getJobName
in interfaceTrigger
-
setName
Description copied from interface:MutableTrigger
Set the name of thisTrigger
.- Specified by:
setName
in interfaceMutableTrigger
-
setJobName
Description copied from interface:MutableTrigger
Set the name of the associated
.JobDetail
- Specified by:
setJobName
in interfaceMutableTrigger
-
getDescription
Description copied from interface:Trigger
Return the description given to theTrigger
instance by its creator (if any).- Specified by:
getDescription
in interfaceTrigger
- Returns:
- null if no description was set.
-
setDescription
Description copied from interface:MutableTrigger
Set a description for theTrigger
instance - may be useful for remembering/displaying the purpose of the trigger, though the description has no meaning to Quartz.- Specified by:
setDescription
in interfaceMutableTrigger
-
setCalendarName
Description copied from interface:MutableTrigger
Associate the
with the given name with this Trigger.Calendar
- Specified by:
setCalendarName
in interfaceMutableTrigger
- Parameters:
calendarName
- usenull
to dis-associate a Calendar.
-
getCalendarName
Description copied from interface:Trigger
Get the name of the
associated with this Trigger.Calendar
- Specified by:
getCalendarName
in interfaceTrigger
- Returns:
null
if there is no associated Calendar.
-
getJobDataMap
Description copied from interface:Trigger
Get theJobDataMap
that is associated with theTrigger
.Changes made to this map during job execution are not re-persisted, and in fact typically result in an
IllegalStateException
.- Specified by:
getJobDataMap
in interfaceTrigger
-
setJobDataMap
Description copied from interface:MutableTrigger
Set theJobDataMap
to be associated with theTrigger
.- Specified by:
setJobDataMap
in interfaceMutableTrigger
-
getPriority
public int getPriority()Description copied from interface:Trigger
The priority of aTrigger
acts as a tiebreaker such that if twoTrigger
s 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
.- Specified by:
getPriority
in interfaceTrigger
- See Also:
-
setPriority
public void setPriority(int priority) Description copied from interface:MutableTrigger
The priority of aTrigger
acts as a tie breaker such that if twoTrigger
s 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
.- Specified by:
setPriority
in interfaceMutableTrigger
- See Also:
-
getMisfireInstruction
public int getMisfireInstruction()Description copied from interface:Trigger
Get the instruction theScheduler
should be given for handling misfire situations for thisTrigger
- the concreteTrigger
type that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXX
constants that may be set as this property's value.If not explicitly set, the default value is
MISFIRE_INSTRUCTION_SMART_POLICY
.- Specified by:
getMisfireInstruction
in interfaceTrigger
- See Also:
-
Trigger.MISFIRE_INSTRUCTION_SMART_POLICY
-
invalid @see
#updateAfterMisfire(Calendar)
SimpleTrigger
CronTrigger
-
setMisfireInstruction
public void setMisfireInstruction(int misfireInstruction) Description copied from interface:MutableTrigger
Set the instruction theScheduler
should be given for handling misfire situations for thisTrigger
- the concreteTrigger
type that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXX
constants that may be passed to this method.If not explicitly set, the default value is
MISFIRE_INSTRUCTION_SMART_POLICY
.- Specified by:
setMisfireInstruction
in interfaceMutableTrigger
- See Also:
-
Trigger.MISFIRE_INSTRUCTION_SMART_POLICY
-
invalid @see
#updateAfterMisfire(Calendar)
SimpleTrigger
CronTrigger
-
executionComplete
public Trigger.CompletedExecutionInstruction executionComplete(JobExecutionContext context, JobExecutionException result) Description copied from interface:OperableTrigger
This method should not be used by the Quartz client.Called after the
has executed theScheduler
JobDetail
Trigger
in order to get the final instruction code from the trigger.- Specified by:
executionComplete
in interfaceOperableTrigger
- Parameters:
context
- is theJobExecutionContext
that was used by theJob
'sexecute(xx)
method.result
- is theJobExecutionException
thrown by theJob
, if any (may be null).- Returns:
- one of the
CompletedExecutionInstruction
constants. - See Also:
-
validate
Description copied from interface:OperableTrigger
Validates whether the properties of theJobDetail
are valid for submission into aScheduler
.- Specified by:
validate
in interfaceOperableTrigger
- Throws:
SchedulerException
-
setFireInstanceId
Description copied from interface:OperableTrigger
This method should not be used by the Quartz client.Usable by
implementations, in order to facilitate 'recognizing' instances of firedJobStore
Trigger
s as their jobs complete execution.- Specified by:
setFireInstanceId
in interfaceOperableTrigger
-
getFireInstanceId
Description copied from interface:OperableTrigger
This method should not be used by the Quartz client.- Specified by:
getFireInstanceId
in interfaceOperableTrigger
-
compareTo
Compare the next fire time of thisTrigger
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.- Specified by:
compareTo
in interfaceComparable<Trigger>
-
equals
Trigger equality is based upon the equality of the Trigger name. -
hashCode
public int hashCode() -
clone
- Specified by:
clone
in interfaceMutableTrigger
- Overrides:
clone
in classObject
-
toString
-