Interface Trigger
- All Superinterfaces:
Cloneable
,Comparable<Trigger>
,Serializable
- All Known Subinterfaces:
CronTrigger
,MutableTrigger
,OperableTrigger
,SimpleTrigger
- All Known Implementing Classes:
AbstractTrigger
,CronTriggerImpl
,SimpleTriggerImpl
Trigger
s - use TriggerBuilder
to instantiate an actual Trigger.
Triggers
s have a
invalid @link
TriggerKey
.
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
-
Nested Class Summary
Modifier and TypeInterfaceDescriptionstatic enum
static class
A Comparator that compares trigger's next fire times, or in other words, sorts them according to earliest next fire time. -
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The default value for priority.static final int
Instructs the
that theScheduler
Trigger
will never be evaluated for a misfire situation, and that the scheduler will simply try to fire it as soon as it can, and then update the Trigger as if it had fired at the proper time.static final int
Instructs the
that upon a mis-fire situation, theScheduler
updateAfterMisfire()
method will be called on theTrigger
to determine the mis-fire instruction, which logic will be trigger-implementation-dependent. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Trigger equality is based upon the equality of the TriggerKey.Get the name of the
associated with this Trigger.Calendar
Return the description given to theTrigger
instance by its creator (if any).Get the time at which theTrigger
should quit repeating - regardless of any remaining repeats (based on the trigger's particular repeat settings).Returns the last time at which theTrigger
will fire, if the Trigger will repeat indefinitely, null will be returned.getFireTimeAfter
(Date afterTime) Returns the next time at which theTrigger
will fire, after the given time.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
.Returns the next time at which theTrigger
is scheduled to fire.Returns the previous time at which theTrigger
fired.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.Get the time at which theTrigger
should occur.boolean
Used by the
to determine whether or not it is possible for thisScheduler
Trigger
to fire again.Methods inherited from interface java.lang.Comparable
compareTo
-
Field Details
-
MISFIRE_INSTRUCTION_SMART_POLICY
static final int MISFIRE_INSTRUCTION_SMART_POLICYInstructs the
that upon a mis-fire situation, theScheduler
updateAfterMisfire()
method will be called on theTrigger
to determine the mis-fire instruction, which logic will be trigger-implementation-dependent.In order to see if this instruction fits your needs, you should look at the documentation for the
getSmartMisfirePolicy()
method on the particularTrigger
implementation you are using.- See Also:
-
MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY
static final int MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICYInstructs the
that theScheduler
Trigger
will never be evaluated for a misfire situation, and that the scheduler will simply try to fire it as soon as it can, and then update the Trigger as if it had fired at the proper time.NOTE: if a trigger uses this instruction, and it has missed several of its scheduled firings, then
- See Also:
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITYThe default value for priority.- See Also:
-
-
Method Details
-
getName
String getName()Get the name of thisTrigger
. -
getJobName
String getJobName()Get the name of the associated
.JobDetail
-
getDescription
String getDescription()Return the description given to theTrigger
instance by its creator (if any).- Returns:
- null if no description was set.
-
getCalendarName
String getCalendarName()Get the name of the
associated with this Trigger.Calendar
- Returns:
null
if there is no associated Calendar.
-
getJobDataMap
JobDataMap getJobDataMap()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
. -
getPriority
int getPriority()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
.- See Also:
-
mayFireAgain
boolean mayFireAgain() -
getStartTime
Date getStartTime()Get the time at which theTrigger
should occur. -
getEndTime
Date getEndTime()Get the time at which theTrigger
should quit repeating - regardless of any remaining repeats (based on the trigger's particular repeat settings).- See Also:
-
getNextFireTime
Date getNextFireTime()Returns the next time at which theTrigger
is scheduled to fire. If the trigger will not fire again,null
will be returned. Note that the time returned can possibly be in the past, if the time that was computed for the trigger to next fire has already arrived, but the scheduler has not yet been able to fire the trigger (which would likely be due to lack of resources e.g. threads).The value returned is not guaranteed to be valid until after the
Trigger
has been added to the scheduler.- See Also:
-
-
invalid @see
TriggerUtils#computeFireTimesBetween(Trigger, Calendar, Date, Date)
-
-
getPreviousFireTime
Date getPreviousFireTime()Returns the previous time at which theTrigger
fired. If the trigger has not yet fired,null
will be returned. -
getFireTimeAfter
Returns the next time at which theTrigger
will fire, after the given time. If the trigger will not fire after the given time,null
will be returned. -
getFinalFireTime
Date getFinalFireTime()Returns the last time at which theTrigger
will fire, if the Trigger will repeat indefinitely, null will be returned.Note that the return time *may* be in the past.
-
getMisfireInstruction
int getMisfireInstruction()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
.- See Also:
-
MISFIRE_INSTRUCTION_SMART_POLICY
-
invalid @see
#updateAfterMisfire(Calendar)
SimpleTrigger
CronTrigger
-
equals
Trigger equality is based upon the equality of the TriggerKey.
-