Class AbstractTrigger
- All Implemented Interfaces:
Serializable,Cloneable,Comparable<Trigger>,MutableTrigger,OperableTrigger,Trigger
- Direct Known Subclasses:
CronTriggerImpl,SimpleTriggerImpl
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.
- 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
FieldsFields inherited from interface org.quartz.triggers.Trigger
DEFAULT_PRIORITY, MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY, MISFIRE_INSTRUCTION_SMART_POLICY -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionclone()intCompare the next fire time of thisTriggerto that of another by comparing their keys, or in other words, sorts them according to the natural (i.e.booleanTrigger 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 theassociated with this Trigger.CalendarReturn the description given to theTriggerinstance by its creator (if any).This method should not be used by the Quartz client.Get theJobDataMapthat is associated with theTrigger.Get the name of the associated.JobDetailintGet the instruction theSchedulershould be given for handling misfire situations for thisTrigger- the concreteTriggertype that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXXconstants that may be set as this property's value.getName()Get the name of thisTrigger.intThe priority of aTriggeracts as a tiebreaker such that if twoTriggers have the same scheduled fire time, then the one with the higher priority will get first access to a worker thread.inthashCode()voidsetCalendarName(String calendarName) Associate thewith the given name with this Trigger.CalendarvoidsetDescription(String description) Set a description for theTriggerinstance - may be useful for remembering/displaying the purpose of the trigger, though the description has no meaning to Quartz.voidThis method should not be used by the Quartz client.voidsetJobDataMap(JobDataMap jobDataMap) Set theJobDataMapto be associated with theTrigger.voidsetJobName(String jobName) Set the name of the associated.JobDetailvoidsetMisfireInstruction(int misfireInstruction) Set the instruction theSchedulershould be given for handling misfire situations for thisTrigger- the concreteTriggertype that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXXconstants that may be passed to this method.voidSet the name of thisTrigger.voidsetPriority(int priority) The priority of aTriggeracts as a tie breaker such that if twoTriggers 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()voidvalidate()Validates whether the properties of theJobDetailare valid for submission into aScheduler.protected abstract booleanvalidateMisfireInstruction(int misfireInstruction) Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.quartz.triggers.MutableTrigger
setEndTime, setStartTimeMethods inherited from interface org.quartz.triggers.OperableTrigger
computeFirstFireTime, setNextFireTime, setPreviousFireTime, triggered, updateAfterMisfireMethods 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 aTriggerwith no specified name, group, or.JobDetailNote that the
setName(String)and thesetJobName(String)methods must be called before theTriggercan be placed into aScheduler.
-
-
Method Details
-
validateMisfireInstruction
protected abstract boolean validateMisfireInstruction(int misfireInstruction) -
getName
Description copied from interface:TriggerGet the name of thisTrigger. -
getJobName
Description copied from interface:TriggerGet the name of the associated.JobDetail- Specified by:
getJobNamein interfaceTrigger
-
setName
Description copied from interface:MutableTriggerSet the name of thisTrigger.- Specified by:
setNamein interfaceMutableTrigger
-
setJobName
Description copied from interface:MutableTriggerSet the name of the associated.JobDetail- Specified by:
setJobNamein interfaceMutableTrigger
-
getDescription
Description copied from interface:TriggerReturn the description given to theTriggerinstance by its creator (if any).- Specified by:
getDescriptionin interfaceTrigger- Returns:
- null if no description was set.
-
setDescription
Description copied from interface:MutableTriggerSet a description for theTriggerinstance - may be useful for remembering/displaying the purpose of the trigger, though the description has no meaning to Quartz.- Specified by:
setDescriptionin interfaceMutableTrigger
-
setCalendarName
Description copied from interface:MutableTriggerAssociate thewith the given name with this Trigger.Calendar- Specified by:
setCalendarNamein interfaceMutableTrigger- Parameters:
calendarName- usenullto dis-associate a Calendar.
-
getCalendarName
Description copied from interface:TriggerGet the name of theassociated with this Trigger.Calendar- Specified by:
getCalendarNamein interfaceTrigger- Returns:
nullif there is no associated Calendar.
-
getJobDataMap
Description copied from interface:TriggerGet theJobDataMapthat 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:
getJobDataMapin interfaceTrigger
-
setJobDataMap
Description copied from interface:MutableTriggerSet theJobDataMapto be associated with theTrigger.- Specified by:
setJobDataMapin interfaceMutableTrigger
-
getPriority
public int getPriority()Description copied from interface:TriggerThe priority of aTriggeracts as a tiebreaker such that if twoTriggers 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:
getPriorityin interfaceTrigger- See Also:
-
setPriority
public void setPriority(int priority) Description copied from interface:MutableTriggerThe priority of aTriggeracts as a tie breaker such that if twoTriggers 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:
setPriorityin interfaceMutableTrigger- See Also:
-
getMisfireInstruction
public int getMisfireInstruction()Description copied from interface:TriggerGet the instruction theSchedulershould be given for handling misfire situations for thisTrigger- the concreteTriggertype that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXXconstants that may be set as this property's value.If not explicitly set, the default value is
MISFIRE_INSTRUCTION_SMART_POLICY.- Specified by:
getMisfireInstructionin interfaceTrigger- See Also:
-
Trigger.MISFIRE_INSTRUCTION_SMART_POLICY-
invalid @see
#updateAfterMisfire(Calendar) SimpleTriggerCronTrigger
-
setMisfireInstruction
public void setMisfireInstruction(int misfireInstruction) Description copied from interface:MutableTriggerSet the instruction theSchedulershould be given for handling misfire situations for thisTrigger- the concreteTriggertype that you are using will have defined a set of additionalMISFIRE_INSTRUCTION_XXXconstants that may be passed to this method.If not explicitly set, the default value is
MISFIRE_INSTRUCTION_SMART_POLICY.- Specified by:
setMisfireInstructionin interfaceMutableTrigger- See Also:
-
Trigger.MISFIRE_INSTRUCTION_SMART_POLICY-
invalid @see
#updateAfterMisfire(Calendar) SimpleTriggerCronTrigger
-
executionComplete
public Trigger.CompletedExecutionInstruction executionComplete(JobExecutionContext context, JobExecutionException result) Description copied from interface:OperableTriggerThis method should not be used by the Quartz client.Called after the
has executed theSchedulerassociated with theJobDetailTriggerin order to get the final instruction code from the trigger.- Specified by:
executionCompletein interfaceOperableTrigger- Parameters:
context- is theJobExecutionContextthat was used by theJob'sexecute(xx)method.result- is theJobExecutionExceptionthrown by theJob, if any (may be null).- Returns:
- one of the
CompletedExecutionInstructionconstants. - See Also:
-
validate
Description copied from interface:OperableTriggerValidates whether the properties of theJobDetailare valid for submission into aScheduler.- Specified by:
validatein interfaceOperableTrigger- Throws:
SchedulerException
-
setFireInstanceId
Description copied from interface:OperableTriggerThis method should not be used by the Quartz client.Usable by
implementations, in order to facilitate 'recognizing' instances of firedJobStoreTriggers as their jobs complete execution.- Specified by:
setFireInstanceIdin interfaceOperableTrigger
-
getFireInstanceId
Description copied from interface:OperableTriggerThis method should not be used by the Quartz client.- Specified by:
getFireInstanceIdin interfaceOperableTrigger
-
compareTo
Compare the next fire time of thisTriggerto 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:
compareToin interfaceComparable<Trigger>
-
equals
Trigger equality is based upon the equality of the Trigger name. -
hashCode
public int hashCode() -
clone
- Specified by:
clonein interfaceMutableTrigger- Overrides:
clonein classObject
-
toString
-