|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.impl.triggers.AbstractTrigger<T>
public abstract class AbstractTrigger<T extends Trigger>
The base abstract class to be extended by all 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
.
SimpleTrigger
,
CronTrigger
,
NthIncludedDayTrigger
,
TriggerUtils
,
JobDataMap
,
JobExecutionContext
,
Serialized FormNested Class Summary |
---|
Nested classes/interfaces inherited from interface org.quartz.Trigger |
---|
Trigger.CompletedExecutionInstruction, Trigger.TriggerState, Trigger.TriggerTimeComparator |
Field Summary |
---|
Fields inherited from interface org.quartz.Trigger |
---|
DEFAULT_PRIORITY, MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY, MISFIRE_INSTRUCTION_SMART_POLICY |
Constructor Summary | |
---|---|
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. |
Method Summary | |
---|---|
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. |
abstract java.util.Date |
computeFirstFireTime(Calendar calendar)
This method should not be used by the Quartz client. |
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). |
abstract java.util.Date |
getEndTime()
Get the time at which the Trigger should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings). |
abstract java.util.Date |
getFinalFireTime()
Returns the last time at which the Trigger will fire, if
the Trigger will repeat indefinitely, null will be returned. |
java.lang.String |
getFireInstanceId()
This method should not be used by the Quartz client. |
abstract java.util.Date |
getFireTimeAfter(java.util.Date afterTime)
Returns the next time at which the Trigger will fire,
after the given time. |
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 . |
abstract java.util.Date |
getNextFireTime()
Returns the next time at which the Trigger is scheduled to fire. |
abstract java.util.Date |
getPreviousFireTime()
Returns the previous time at which the Trigger fired. |
int |
getPriority()
The priority of a Trigger acts as a tiebreaker such that if
two Trigger s 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. |
abstract java.util.Date |
getStartTime()
Get the time at which the Trigger should occur. |
TriggerBuilder<T> |
getTriggerBuilder()
Get a TriggerBuilder that is configured to produce a
Trigger identical to this one. |
int |
hashCode()
|
abstract boolean |
mayFireAgain()
Used by the to determine whether or not
it is possible for this Trigger to fire again. |
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. |
abstract void |
setEndTime(java.util.Date endTime)
Set the time at which the Trigger should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings). |
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 Trigger 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. |
abstract void |
setStartTime(java.util.Date startTime)
The time at which the trigger's scheduling should start. |
java.lang.String |
toString()
Return a simple string representation of this object. |
abstract void |
triggered(Calendar calendar)
This method should not be used by the Quartz client. |
abstract void |
updateAfterMisfire(Calendar cal)
This method should not be used by the Quartz client. |
abstract void |
updateWithNewCalendar(Calendar cal,
long misfireThreshold)
This method should not be used by the Quartz client. |
void |
validate()
Validates whether the properties of the JobDetail are
valid for submission into a Scheduler . |
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.spi.OperableTrigger |
---|
setNextFireTime, setPreviousFireTime |
Constructor Detail |
---|
public 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
.
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)
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.Method Detail |
---|
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 MutableTrigger
public 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 MutableTrigger
public java.lang.String getFullName()
Returns the 'full name' of the Trigger
in the format
"group.name".
public TriggerKey getKey()
getKey
in interface Trigger
public JobKey getJobKey()
getJobKey
in interface Trigger
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 Trigger
public 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 MutableTrigger
public void setCalendarName(java.lang.String calendarName)
Associate the
with the given name with
this Trigger.
Calendar
setCalendarName
in interface MutableTrigger
calendarName
- 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 Trigger
null
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 Trigger
public void setJobDataMap(JobDataMap jobDataMap)
Set the JobDataMap
to be associated with the
Trigger
.
setJobDataMap
in interface MutableTrigger
public int getPriority()
Trigger
acts as a tiebreaker such that if
two Trigger
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
.
getPriority
in interface Trigger
Trigger.DEFAULT_PRIORITY
public void setPriority(int priority)
Trigger
acts as a tie breaker such that if
two Trigger
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
.
setPriority
in interface MutableTrigger
Trigger.DEFAULT_PRIORITY
public abstract void triggered(Calendar calendar)
This method should not be used by the Quartz client.
Called when the
has decided to 'fire'
the trigger (execute the associated Scheduler
Job
), in order to
give the Trigger
a chance to update itself for its next
triggering (if any).
triggered
in interface OperableTrigger
executionComplete(JobExecutionContext, JobExecutionException)
public abstract java.util.Date computeFirstFireTime(Calendar calendar)
This method should not be used by the Quartz client.
Called by the scheduler at the time a Trigger
is first
added to the scheduler, in order to have the Trigger
compute its first fire time, based on any associated calendar.
After this method has been called, getNextFireTime()
should return a valid answer.
computeFirstFireTime
in interface OperableTrigger
Trigger
will be fired
by the scheduler, which is also the same value getNextFireTime()
will return (until after the first firing of the Trigger
).
public 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 JobDetail
Trigger
in order to get the final instruction code from the trigger.
executionComplete
in interface OperableTrigger
context
- 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
,
triggered(Calendar)
public abstract boolean mayFireAgain()
Used by the
to determine whether or not
it is possible for this Scheduler
Trigger
to fire again.
If the returned value is false
then the Scheduler
may remove the Trigger
from the
.
JobStore
mayFireAgain
in interface Trigger
public abstract java.util.Date getStartTime()
Get the time at which the Trigger
should occur.
getStartTime
in interface Trigger
public abstract void setStartTime(java.util.Date startTime)
The time at which the trigger's scheduling should start. May or may not be the first actual fire time of the trigger, depending upon the type of trigger and the settings of the other properties of the trigger. However the first actual first time will not be before this date.
Setting a value in the past may cause a new trigger to compute a first fire time that is in the past, which may cause an immediate misfire of the trigger.
setStartTime
in interface MutableTrigger
public abstract void setEndTime(java.util.Date endTime)
Set the time at which the Trigger
should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings).
setEndTime
in interface MutableTrigger
TriggerUtils#computeEndTimeToAllowParticularNumberOfFirings(AbstractTrigger, Calendar, int)
public abstract java.util.Date getEndTime()
Get the time at which the Trigger
should quit repeating -
regardless of any remaining repeats (based on the trigger's particular
repeat settings).
getEndTime
in interface Trigger
getFinalFireTime()
public abstract java.util.Date getNextFireTime()
Returns the next time at which the Trigger
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.
getNextFireTime
in interface Trigger
TriggerUtils#computeFireTimesBetween(AbstractTrigger, Calendar, Date, Date)
public abstract java.util.Date getPreviousFireTime()
Returns the previous time at which the Trigger
fired.
If the trigger has not yet fired, null
will be returned.
getPreviousFireTime
in interface Trigger
public abstract java.util.Date getFireTimeAfter(java.util.Date afterTime)
Returns the next time at which the Trigger
will fire,
after the given time. If the trigger will not fire after the given time,
null
will be returned.
getFireTimeAfter
in interface Trigger
public abstract java.util.Date getFinalFireTime()
Returns the last time at which the Trigger
will fire, if
the Trigger will repeat indefinitely, null will be returned.
Note that the return time *may* be in the past.
getFinalFireTime
in interface Trigger
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 MutableTrigger
Trigger.MISFIRE_INSTRUCTION_SMART_POLICY
,
updateAfterMisfire(Calendar)
,
SimpleTrigger
,
CronTrigger
protected abstract boolean validateMisfireInstruction(int misfireInstruction)
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 Trigger
Trigger.MISFIRE_INSTRUCTION_SMART_POLICY
,
updateAfterMisfire(Calendar)
,
SimpleTrigger
,
CronTrigger
public abstract void updateAfterMisfire(Calendar cal)
This method should not be used by the Quartz client.
To be implemented by the concrete classes that extend this class.
The implementation should update the Trigger
's state
based on the MISFIRE_INSTRUCTION_XXX that was selected when the Trigger
was created.
updateAfterMisfire
in interface OperableTrigger
public abstract void updateWithNewCalendar(Calendar cal, long misfireThreshold)
This method should not be used by the Quartz client.
To be implemented by the concrete class.
The implementation should update the Trigger
's state
based on the given new version of the associated Calendar
(the state should be updated so that it's next fire time is appropriate
given the Calendar's new settings).
updateWithNewCalendar
in interface OperableTrigger
cal
- public void validate() throws SchedulerException
Validates whether the properties of the JobDetail
are
valid for submission into a Scheduler
.
validate
in interface OperableTrigger
java.lang.IllegalStateException
- if a required property (such as Name, Group, Class) is not
set.
SchedulerException
public 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
JobStore
Trigger
s as their jobs complete execution.
setFireInstanceId
in interface OperableTrigger
public java.lang.String getFireInstanceId()
This method should not be used by the Quartz client.
getFireInstanceId
in interface OperableTrigger
public java.lang.String toString()
Return a simple string representation of this object.
toString
in class java.lang.Object
public 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.
compareTo
in interface java.lang.Comparable<Trigger>
compareTo
in interface Trigger
public boolean equals(java.lang.Object o)
equals
in interface Trigger
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone()
clone
in interface MutableTrigger
clone
in class java.lang.Object
public TriggerBuilder<T> getTriggerBuilder()
Trigger
TriggerBuilder
that is configured to produce a
Trigger
identical to this one.
getTriggerBuilder
in interface Trigger
Trigger.getScheduleBuilder()
public abstract ScheduleBuilder<T> getScheduleBuilder()
Trigger
ScheduleBuilder
that is configured to produce a
schedule identical to this trigger's schedule.
getScheduleBuilder
in interface Trigger
Trigger.getTriggerBuilder()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |