|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.quartz.Trigger
org.quartz.SimpleTrigger
A concrete
that is used to fire a
Trigger
at a given moment in time, and optionally repeated
at a specified interval.JobDetail
Trigger
,
CronTrigger
,
Serialized FormField Summary | |
static int |
MISFIRE_INSTRUCTION_FIRE_NOW
Instructs the that upon a mis-fire
situation, the wants to be fired now by
Scheduler . |
static int |
MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
Instructs the that upon a mis-fire
situation, the wants to be re-scheduled
to the next scheduled time after 'now' - taking into account any associated
, and with the repeat count left
unchanged. |
static int |
MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
Instructs the that upon a mis-fire
situation, the wants to be re-scheduled
to the next scheduled time after 'now' - taking into account any associated
, and with the repeat count set to
what it would be, if it had not missed any firings. |
static int |
MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
Instructs the that upon a mis-fire
situation, the wants to be re-scheduled
to 'now' (even if the associated excludes
'now') with the repeat count left as-is. |
static int |
MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
Instructs the that upon a mis-fire
situation, the wants to be re-scheduled
to 'now' (even if the associated excludes
'now') with the repeat count set to what it would be, if it had not
missed any firings. |
static int |
REPEAT_INDEFINITELY
Used to indicate the 'repeat count' of the trigger is indefinite. |
Fields inherited from class org.quartz.Trigger |
INSTRUCTION_DELETE_TRIGGER, INSTRUCTION_NOOP, INSTRUCTION_RE_EXECUTE_JOB, INSTRUCTION_SET_ALL_JOB_TRIGGERS_COMPLETE, INSTRUCTION_SET_TRIGGER_COMPLETE, MISFIRE_INSTRUCTION_SMART_POLICY, STATE_COMPLETE, STATE_ERROR, STATE_NONE, STATE_NORMAL, STATE_PAUSED |
Constructor Summary | |
SimpleTrigger()
Create a SimpleTrigger with no settings. |
|
SimpleTrigger(java.lang.String name,
java.lang.String group)
Create a SimpleTrigger that will occur immediately,
and not repeat. |
|
SimpleTrigger(java.lang.String name,
java.lang.String group,
java.util.Date startTime)
Create a SimpleTrigger that will occur at the given
time, and not repeat. |
|
SimpleTrigger(java.lang.String name,
java.lang.String group,
java.util.Date startTime,
java.util.Date endTime,
int repeatCount,
long repeatInterval)
Create a SimpleTrigger that will occur at the given
time, and repeat at the the given interval the given number of times, or
until the given end time. |
|
SimpleTrigger(java.lang.String name,
java.lang.String group,
int repeatCount,
long repeatInterval)
Create a SimpleTrigger that will occur immediately,
and repeat at the the given interval the given number of times. |
|
SimpleTrigger(java.lang.String name,
java.lang.String group,
java.lang.String jobName,
java.lang.String jobGroup,
java.util.Date startTime,
java.util.Date endTime,
int repeatCount,
long repeatInterval)
Create a SimpleTrigger that will occur at the given
time, fire the identified Job and repeat at the the given
interval the given number of times, or until the given end time. |
Method Summary | |
java.util.Date |
computeFirstFireTime(Calendar calendar)
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. |
int |
computeNumTimesFiredBetween(java.util.Date start,
java.util.Date end)
|
int |
executionComplete(JobExecutionContext context,
JobExecutionException result)
Called after the has executed the
associated with the Trigger in order
to get the final instruction code from the trigger. |
java.util.Date |
getEndTime()
Get the time at which the SimpleTrigger should quit
repeating - even if repeastCount isn't yet satisfied. |
java.util.Date |
getFinalFireTime()
Returns the final time at which the SimpleTrigger will
fire, if repeatCount is REPEAT_INDEFINITELY, null will be returned. |
java.util.Date |
getFireTimeAfter(java.util.Date afterTime)
Returns the next time at which the SimpleTrigger will
fire, after the given time. |
java.util.Date |
getFireTimeBefore(java.util.Date end)
Returns the last time at which the SimpleTrigger will
fire, before the given time. |
java.util.Date |
getNextFireTime()
Returns the next time at which the SimpleTrigger will
fire. |
java.util.Date |
getPreviousFireTime()
Returns the previous time at which the SimpleTrigger will
fire. |
int |
getRepeatCount()
Get the the number of times the SimpleTrigger should
repeat, after which it will be automatically deleted. |
long |
getRepeatInterval()
Get the the time interval (in milliseconds) at which the SimpleTrigger should repeat. |
java.util.Date |
getStartTime()
Get the time at which the SimpleTrigger should
occur. |
int |
getTimesTriggered()
Get the number of times the SimpleTrigger has already
fired. |
static void |
main(java.lang.String[] args)
|
boolean |
mayFireAgain()
Determines whether or not the SimpleTrigger will occur
again. |
void |
setEndTime(java.util.Date endTime)
Set the time at which the SimpleTrigger should quit
repeating (and be automatically deleted). |
void |
setNextFireTime(java.util.Date nextFireTime)
Set the next time at which the SimpleTrigger should fire. |
void |
setPreviousFireTime(java.util.Date previousFireTime)
Set the previous time at which the SimpleTrigger fired. |
void |
setRepeatCount(int repeatCount)
Set the the number of time the SimpleTrigger should
repeat, after which it will be automatically deleted. |
void |
setRepeatInterval(long repeatInterval)
Set the the time interval (in milliseconds) at which the SimpleTrigger should repeat. |
void |
setStartTime(java.util.Date startTime)
Set the time at which the SimpleTrigger should
occur. |
void |
setTimesTriggered(int timesTriggered)
Set the number of times the SimpleTrigger has already
fired. |
void |
triggered(Calendar calendar)
Called when the has decided to 'fire'
the trigger (execute the associated Job ), in order to give
the Trigger a chance to update itself for its next
triggering (if any). |
void |
updateAfterMisfire(Calendar cal)
Updates the SimpleTrigger 's state based on the
MISFIRE_INSTRUCTION_XXX that was selected when the
SimpleTrigger was created. |
void |
validate()
Validates whether the properties of the JobDetail are
valid for submission into a Scheduler . |
protected boolean |
validateMisfireInstruction(int misfireInstruction)
|
Methods inherited from class org.quartz.Trigger |
addTriggerListener, clone, compareTo, equals, getCalendarName, getDescription, getFireInstanceId, getFullJobName, getFullName, getGroup, getJobGroup, getJobName, getMisfireInstruction, getName, getTriggerListenerNames, isVolatile, removeTriggerListener, setCalendarName, setDescription, setFireInstanceId, setGroup, setJobGroup, setJobName, setMisfireInstruction, setName, setVolatility, toString |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int MISFIRE_INSTRUCTION_FIRE_NOW
Instructs the
that upon a mis-fire
situation, the Scheduler
wants to be fired now by
SimpleTrigger
Scheduler
.
NOTE: This instruction should typically only be used for
'one-shot' (non-repeating) Triggers. If it is used on a trigger with a
repeat count > 0 then it is equivalent to the instruction
.MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
public static final int MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
Instructs the
that upon a mis-fire
situation, the Scheduler
wants to be re-scheduled
to 'now' (even if the associated SimpleTrigger
excludes
'now') with the repeat count left as-is.Calendar
NOTE: Use of this instruction causes the trigger to 'forget' the start-time and repeat-count that it was originally setup with (this is only an issue if you for some reason wanted to be able to tell what the original values were at some later time).
NOTE: This instruction could cause the Trigger
to
go to the 'COMPLETE' state after firing 'now', if all the repeat-fire-times
where missed.
public static final int MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_REMAINING_REPEAT_COUNT
Instructs the
that upon a mis-fire
situation, the Scheduler
wants to be re-scheduled
to 'now' (even if the associated SimpleTrigger
excludes
'now') with the repeat count set to what it would be, if it had not
missed any firings.Calendar
NOTE: Use of this instruction causes the trigger to 'forget' the start-time and repeat-count that it was originally setup with (this is only an issue if you for some reason wanted to be able to tell what the original values were at some later time).
NOTE: This instruction could cause the Trigger
to
go to the 'COMPLETE' state after firing 'now', if all the repeat-fire-times
where missed.
public static final int MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
Instructs the
that upon a mis-fire
situation, the Scheduler
wants to be re-scheduled
to the next scheduled time after 'now' - taking into account any associated
SimpleTrigger
, and with the repeat count set to
what it would be, if it had not missed any firings.Calendar
NOTE: This instruction could cause the Trigger
to
go directly to the 'COMPLETE' state if all fire-times where missed.
public static final int MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_EXISTING_COUNT
Instructs the
that upon a mis-fire
situation, the Scheduler
wants to be re-scheduled
to the next scheduled time after 'now' - taking into account any associated
SimpleTrigger
, and with the repeat count left
unchanged.Calendar
NOTE: Use of this instruction causes the trigger to 'forget' the repeat-count that it was originally setup with (this is only an issue if you for some reason wanted to be able to tell what the original values were at some later time).
NOTE: This instruction could cause the Trigger
to
go directly to the 'COMPLETE' state if all fire-times where missed.
public static int REPEAT_INDEFINITELY
Used to indicate the 'repeat count' of the trigger is indefinite. Or in other words, the trigger should repeat continually until the trigger's ending timestamp.
Constructor Detail |
public SimpleTrigger()
Create a SimpleTrigger
with no settings.
public SimpleTrigger(java.lang.String name, java.lang.String group)
Create a SimpleTrigger
that will occur immediately,
and not repeat.
public SimpleTrigger(java.lang.String name, java.lang.String group, int repeatCount, long repeatInterval)
Create a SimpleTrigger
that will occur immediately,
and repeat at the the given interval the given number of times.
public SimpleTrigger(java.lang.String name, java.lang.String group, java.util.Date startTime)
Create a SimpleTrigger
that will occur at the given
time, and not repeat.
public SimpleTrigger(java.lang.String name, java.lang.String group, java.util.Date startTime, java.util.Date endTime, int repeatCount, long repeatInterval)
Create a SimpleTrigger
that will occur at the given
time, and repeat at the the given interval the given number of times, or
until the given end time.
startTime
- A Date
set to the time for the
Trigger
to fire.endTime
- A Date
set to the time for the
Trigger
to quit repeat firing.repeatCount
- The number of times for the Trigger
to
repeat firing, use REPEAT_INDEFINITELY
for unlimitted times.repeatInterval
- The number of milliseconds to pause between the
repeat firing.public SimpleTrigger(java.lang.String name, java.lang.String group, java.lang.String jobName, java.lang.String jobGroup, java.util.Date startTime, java.util.Date endTime, int repeatCount, long repeatInterval)
Create a SimpleTrigger
that will occur at the given
time, fire the identified Job
and repeat at the the given
interval the given number of times, or until the given end time.
startTime
- A Date
set to the time for the
Trigger
to fire.endTime
- A Date
set to the time for the
Trigger
to quit repeat firing.repeatCount
- The number of times for the Trigger
to
repeat firing, use REPEAT_INDEFINITELY
for unlimitted times.repeatInterval
- The number of milliseconds to pause between the
repeat firing.Method Detail |
public java.util.Date getStartTime()
Get the time at which the SimpleTrigger
should
occur.
getStartTime
in class Trigger
public void setStartTime(java.util.Date startTime)
Set the time at which the SimpleTrigger
should
occur.
java.lang.IllegalArgumentException
- if startTime is null
.public java.util.Date getEndTime()
Get the time at which the SimpleTrigger
should quit
repeating - even if repeastCount isn't yet satisfied.
getEndTime
in class Trigger
getFinalFireTime()
public void setEndTime(java.util.Date endTime)
Set the time at which the SimpleTrigger
should quit
repeating (and be automatically deleted).
java.lang.IllegalArgumentException
- if endTime is before start time.public int getRepeatCount()
Get the the number of times the SimpleTrigger
should
repeat, after which it will be automatically deleted.
REPEAT_INDEFINITELY
public void setRepeatCount(int repeatCount)
Set the the number of time the SimpleTrigger
should
repeat, after which it will be automatically deleted.
java.lang.IllegalArgumentException
- if repeatCount is < 0REPEAT_INDEFINITELY
public long getRepeatInterval()
Get the the time interval (in milliseconds) at which the
SimpleTrigger
should repeat.
public void setRepeatInterval(long repeatInterval)
Set the the time interval (in milliseconds) at which the
SimpleTrigger
should repeat.
java.lang.IllegalArgumentException
- if repeatInterval is < 0public int getTimesTriggered()
Get the number of times the SimpleTrigger
has already
fired.
public void setTimesTriggered(int timesTriggered)
Set the number of times the SimpleTrigger
has already
fired.
protected boolean validateMisfireInstruction(int misfireInstruction)
validateMisfireInstruction
in class Trigger
public void updateAfterMisfire(Calendar cal)
Updates the SimpleTrigger
's state based on the
MISFIRE_INSTRUCTION_XXX that was selected when the
SimpleTrigger
was created.
If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY,
then the following scheme will be used:
0
, then the instruction will be
interpreted as MISFIRE_INSTRUCTION_FIRE_NOW
.REPEAT_INDEFINITELY
, then the
instruction will be interpreted as
MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
.
> 0
, then the
instruction will be interpreted as
MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
.
updateAfterMisfire
in class Trigger
public void triggered(Calendar calendar)
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 class Trigger
executionComplete(JobExecutionContext, JobExecutionException)
public java.util.Date computeFirstFireTime(Calendar calendar)
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 class Trigger
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 int executionComplete(JobExecutionContext context, JobExecutionException result)
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 class 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).
Trigger.INSTRUCTION_NOOP
,
Trigger.INSTRUCTION_RE_EXECUTE_JOB
,
Trigger.INSTRUCTION_DELETE_TRIGGER
,
Trigger.INSTRUCTION_SET_TRIGGER_COMPLETE
,
triggered(Calendar)
public java.util.Date getNextFireTime()
Returns the next time at which the SimpleTrigger
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.
getNextFireTime
in class Trigger
public java.util.Date getPreviousFireTime()
Returns the previous time at which the SimpleTrigger
will
fire. If the trigger has not yet fired, null
will be
returned.
getPreviousFireTime
in class Trigger
public void setNextFireTime(java.util.Date nextFireTime)
Set the next time at which the SimpleTrigger
should fire.
This method should not be invoked by client code.
public void setPreviousFireTime(java.util.Date previousFireTime)
Set the previous time at which the SimpleTrigger
fired.
This method should not be invoked by client code.
public java.util.Date getFireTimeAfter(java.util.Date afterTime)
Returns the next time at which the SimpleTrigger
will
fire, after the given time. If the trigger will not fire after the
given time, null
will be returned.
getFireTimeAfter
in class Trigger
public java.util.Date getFireTimeBefore(java.util.Date end)
Returns the last time at which the SimpleTrigger
will
fire, before the given time. If the trigger will not fire before the
given time, null
will be returned.
public int computeNumTimesFiredBetween(java.util.Date start, java.util.Date end)
public java.util.Date getFinalFireTime()
Returns the final time at which the SimpleTrigger
will
fire, if repeatCount is REPEAT_INDEFINITELY, null will be returned.
Note that the return time may be in the past.
getFinalFireTime
in class Trigger
public boolean mayFireAgain()
Determines whether or not the SimpleTrigger
will occur
again.
mayFireAgain
in class Trigger
public void validate() throws SchedulerException
Validates whether the properties of the JobDetail
are
valid for submission into a Scheduler
.
validate
in class Trigger
java.lang.IllegalStateException
- if a required property (such as Name, Group,
Class) is not set.
SchedulerException
public static void main(java.lang.String[] args) throws java.lang.Exception
java.lang.Exception
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |