|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.quartz.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
.
SimpleTrigger
,
CronTrigger
,
Serialized FormField Summary | |
static int |
INSTRUCTION_DELETE_TRIGGER
Instructs the that the
wants itself deleted. |
static int |
INSTRUCTION_NOOP
Instructs the that the
has no further instructions. |
static int |
INSTRUCTION_RE_EXECUTE_JOB
Instructs the that the
wants the to
re-execute immediately. |
static int |
INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE
Instructs the that all
Trigger s referencing the same as
this one should be put in the COMPLETE state. |
static int |
INSTRUCTION_SET_TRIGGER_COMPLETE
Instructs the that the
should be put in the COMPLETE
state. |
static int |
MISFIRE_INSTRUCTION_SMART_POLICY
Instructs the that upon a mis-fire
situation, the updateAfterMisfire() method will be called
on the Trigger to determine the mis-fire instruction. |
static int |
STATE_COMPLETE
Indicates that the Trigger is in the "complete" state. |
static int |
STATE_ERROR
Indicates that the Trigger is in the "error" state. |
static int |
STATE_NONE
Indicates that the Trigger does not exist. |
static int |
STATE_NORMAL
Indicates that the Trigger is in the "normal" state. |
static int |
STATE_PAUSED
Indicates that the Trigger is in the "paused" state. |
Constructor Summary | |
Trigger()
Create a Trigger with no specified name, group, or
. |
|
Trigger(java.lang.String name,
java.lang.String group)
Create a Trigger with the given name, and group. |
|
Trigger(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 | |
void |
addTriggerListener(java.lang.String name)
Add the specified name of a to the
end of the Trigger 's list of listeners. |
java.lang.Object |
clone()
|
int |
compareTo(java.lang.Object obj)
Compare the next fire time of this Trigger to that of
another. |
abstract java.util.Date |
computeFirstFireTime(Calendar calendar)
This method should not be used by the Quartz client. |
boolean |
equals(java.lang.Object obj)
|
abstract int |
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 - even if an assigned 'repeatCount' isn't yet satisfied. |
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 . |
java.lang.String |
getJobGroup()
Get the name of the associated 's group. |
java.lang.String |
getJobName()
Get the name of the associated . |
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 will
fire. |
abstract java.util.Date |
getPreviousFireTime()
Returns the previous time at which the Trigger will
fire. |
abstract java.util.Date |
getStartTime()
Get the time at which the Trigger should occur. |
java.lang.String[] |
getTriggerListenerNames()
Returns an array of String s containing the names of all
assigned to the Trigger ,
in the order in which they should be notified. |
boolean |
isVolatile()
Whether or not the Trigger should be persisted in the
for re-use after program restarts. |
abstract boolean |
mayFireAgain()
Used by the to determine whether or not
it is possible for this Trigger to fire again. |
boolean |
removeTriggerListener(java.lang.String name)
Remove the specified name of a from
the Trigger 's list of listeners. |
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 |
setJobGroup(java.lang.String jobGroup)
Set the name of the associated 's group. |
void |
setJobName(java.lang.String jobName)
Set the name of the associated . |
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 |
setVolatility(boolean volatility)
Set whether or not the Trigger should be persisted in the
for re-use after program restarts. |
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. |
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, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int INSTRUCTION_NOOP
Instructs the
that the
Scheduler
has no further instructions.Trigger
public static final int INSTRUCTION_RE_EXECUTE_JOB
Instructs the
that the
Scheduler
wants the Trigger
to
re-execute immediately. If not in a 'RECOVERING' or 'FAILED_OVER'
situation, the execution context will be re-used (giving the
JobDetail
Job
the abilitiy to 'see' anything placed in the context by
its last execution).
public static final int INSTRUCTION_SET_TRIGGER_COMPLETE
Instructs the
that the
Scheduler
should be put in the Trigger
COMPLETE
state.
public static final int INSTRUCTION_DELETE_TRIGGER
public static final int INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE
Instructs the
that all
Scheduler
Trigger
s referencing the same
as
this one should be put in the JobDetail
COMPLETE
state.
public static final int MISFIRE_INSTRUCTION_SMART_POLICY
Instructs the
that upon a mis-fire
situation, the Scheduler
updateAfterMisfire()
method will be called
on the Trigger
to determine the mis-fire instruction.
In order to see if this instruction fits your needs, you should look at
the documentation for the getSmartMisfirePolicy()
method on
the particular Trigger
implementation you are using.
public static final int STATE_NORMAL
Indicates that the Trigger
is in the "normal" state.
public static final int STATE_PAUSED
Indicates that the Trigger
is in the "paused" state.
public static final int STATE_COMPLETE
Indicates that the Trigger
is in the "complete" state.
"Complete" indicates that the trigger has not remaining fire-times in its schedule.
public static final int STATE_ERROR
Indicates that the Trigger
is in the "error" state.
A Trigger
arrives at the error state when the scheduler
attempts to fire it, but cannot due to an error creating and executing
its related job. Most commonly this is due to the Job
's
class not existing in the classpath.
When the trigger is in the error state, the scheduler will make no attempts will be made to fire it.
public static final int STATE_NONE
Indicates that the Trigger
does not exist.
Constructor Detail |
public Trigger()
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 Trigger(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
.
java.lang.IllegalArgumentException
- if name or group are null or empty.public Trigger(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.
java.lang.IllegalArgumentException
- if name or group of the
Trigger
or JobDetail
are null or empty.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
.
java.lang.IllegalArgumentException
- if group is null or empty.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
java.lang.IllegalArgumentException
- if jobGroup is null or empty.public java.lang.String getFullName()
Returns the 'full name' of the Trigger
in the format
"group.name".
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).
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.
public void setVolatility(boolean volatility)
Set whether or not the Trigger
should be persisted in the
for re-use after program restarts.JobStore
public void setCalendarName(java.lang.String calendarName)
Associate the
with the given name with
this Trigger.Calendar
calendarName
- use null
to dis-associate a Calendar.public java.lang.String getCalendarName()
Get the name of the
associated with
this Trigger.Calendar
null
if there is no associated Calendar.public boolean isVolatile()
Whether or not the Trigger
should be persisted in the
for re-use after program restarts.JobStore
If not explicitly set, the default value is false
.
true
if the Trigger
should be garbage
collected along with the Scheduler
.public void addTriggerListener(java.lang.String name)
Add the specified name of a
to the
end of the TriggerListener
Trigger
's list of listeners.
public boolean removeTriggerListener(java.lang.String name)
Remove the specified name of a
from
the TriggerListener
Trigger
's list of listeners.
public java.lang.String[] getTriggerListenerNames()
Returns an array of String
s containing the names of all
assigned to the TriggerListener
Trigger
,
in the order in which they should be notified.
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).
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.
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 abstract int 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.
context
- is the JobExecutionContext
that was used by
the Job
's execute(xx)
method.result
- is the JobExecutionException
thrown by the
Job
, if any (may be null).
INSTRUCTION_NOOP
,
INSTRUCTION_RE_EXECUTE_JOB
,
INSTRUCTION_DELETE_TRIGGER
,
INSTRUCTION_SET_TRIGGER_COMPLETE
,
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
public abstract java.util.Date getStartTime()
Get the time at which the Trigger
should occur.
public abstract java.util.Date getEndTime()
Get the time at which the Trigger
should quit
repeating - even if an assigned 'repeatCount' isn't yet satisfied.
getFinalFireTime()
public abstract java.util.Date getNextFireTime()
Returns the next time at which the Trigger
will
fire. If the trigger will not fire again, null
will be
returned. The value returned is not guaranteed to be valid until after the
Trigger
has been added to the scheduler.
public abstract java.util.Date getPreviousFireTime()
Returns the previous time at which the Trigger
will
fire. If the trigger has not yet fired, null
will be
returned.
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.
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.
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
.
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
.
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.
public void validate() throws SchedulerException
Validates whether the properties of the JobDetail
are
valid for submission into a Scheduler
.
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.
public java.lang.String getFireInstanceId()
This method should not be used by the Quartz client.
public java.lang.String toString()
Return a simple string representation of this object.
public int compareTo(java.lang.Object obj)
Compare the next fire time of this Trigger
to that of
another.
compareTo
in interface java.lang.Comparable
public boolean equals(java.lang.Object obj)
public java.lang.Object clone()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |