|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.impl.triggers.AbstractTrigger<SimpleTrigger> org.quartz.impl.triggers.SimpleTriggerImpl
public class SimpleTriggerImpl
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
,
TriggerUtils
,
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 | |
---|---|
SimpleTriggerImpl()
Create a SimpleTrigger with no settings. |
|
SimpleTriggerImpl(java.lang.String name)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(java.lang.String name,
java.util.Date startTime)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(java.lang.String name,
java.util.Date startTime,
java.util.Date endTime,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(java.lang.String name,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(java.lang.String name,
java.lang.String group)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(java.lang.String name,
java.lang.String group,
java.util.Date startTime)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(java.lang.String name,
java.lang.String group,
java.util.Date startTime,
java.util.Date endTime,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(java.lang.String name,
java.lang.String group,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(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)
Deprecated. use a TriggerBuilder instead |
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)
|
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 Trigger is scheduled to fire. |
java.util.Date |
getPreviousFireTime()
Returns the previous time at which the SimpleTrigger
fired. |
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. |
ScheduleBuilder<SimpleTrigger> |
getScheduleBuilder()
Get a ScheduleBuilder that is configured to produce a
schedule identical to this trigger's schedule. |
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. |
boolean |
hasAdditionalProperties()
Used by extensions of SimpleTrigger to imply that there are additional properties, specifically so that extensions can choose whether to be stored as a serialized blob, or as a flattened SimpleTrigger table. |
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 |
updateWithNewCalendar(Calendar calendar,
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 boolean |
validateMisfireInstruction(int misfireInstruction)
|
Methods inherited from class org.quartz.impl.triggers.AbstractTrigger |
---|
clone, compareTo, equals, executionComplete, getCalendarName, getDescription, getFireInstanceId, getFullJobName, getFullName, getGroup, getJobDataMap, getJobGroup, getJobKey, getJobName, getKey, getMisfireInstruction, getName, getPriority, getTriggerBuilder, hashCode, setCalendarName, setDescription, setFireInstanceId, setGroup, setJobDataMap, setJobGroup, setJobKey, setJobName, setKey, setMisfireInstruction, setName, setPriority, toString |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.quartz.SimpleTrigger |
---|
getTriggerBuilder |
Methods inherited from interface org.quartz.Trigger |
---|
compareTo, equals, getCalendarName, getDescription, getJobDataMap, getJobKey, getKey, getMisfireInstruction, getPriority |
Constructor Detail |
---|
public SimpleTriggerImpl()
Create a SimpleTrigger
with no settings.
@Deprecated public SimpleTriggerImpl(java.lang.String name)
Create a SimpleTrigger
that will occur immediately, and
not repeat.
@Deprecated public SimpleTriggerImpl(java.lang.String name, java.lang.String group)
Create a SimpleTrigger
that will occur immediately, and
not repeat.
@Deprecated public SimpleTriggerImpl(java.lang.String name, int repeatCount, long repeatInterval)
Create a SimpleTrigger
that will occur immediately, and
repeat at the the given interval the given number of times.
@Deprecated public SimpleTriggerImpl(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.
@Deprecated public SimpleTriggerImpl(java.lang.String name, java.util.Date startTime)
Create a SimpleTrigger
that will occur at the given time,
and not repeat.
@Deprecated public SimpleTriggerImpl(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.
@Deprecated public SimpleTriggerImpl(java.lang.String name, 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 SimpleTrigger.REPEAT_INDEFINITELY
for unlimited times.repeatInterval
- The number of milliseconds to pause between the repeat firing.@Deprecated public SimpleTriggerImpl(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 SimpleTrigger.REPEAT_INDEFINITELY
for unlimited times.repeatInterval
- The number of milliseconds to pause between the repeat firing.@Deprecated public SimpleTriggerImpl(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 SimpleTrigger.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 interface Trigger
getStartTime
in class AbstractTrigger<SimpleTrigger>
public void setStartTime(java.util.Date startTime)
Set the time at which the SimpleTrigger
should occur.
setStartTime
in interface MutableTrigger
setStartTime
in class AbstractTrigger<SimpleTrigger>
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 interface Trigger
getEndTime
in class AbstractTrigger<SimpleTrigger>
getFinalFireTime()
public void setEndTime(java.util.Date endTime)
Set the time at which the SimpleTrigger
should quit
repeating (and be automatically deleted).
setEndTime
in interface MutableTrigger
setEndTime
in class AbstractTrigger<SimpleTrigger>
java.lang.IllegalArgumentException
- if endTime is before start time.TriggerUtils#computeEndTimeToAllowParticularNumberOfFirings(AbstractTrigger, Calendar, int)
public int getRepeatCount()
SimpleTrigger
Get the the number of times the SimpleTrigger
should
repeat, after which it will be automatically deleted.
getRepeatCount
in interface SimpleTrigger
SimpleTrigger.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 < 0SimpleTrigger.REPEAT_INDEFINITELY
public long getRepeatInterval()
SimpleTrigger
Get the the time interval (in milliseconds) at which the SimpleTrigger
should repeat.
getRepeatInterval
in interface SimpleTrigger
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.
getTimesTriggered
in interface SimpleTrigger
public void setTimesTriggered(int timesTriggered)
Set the number of times the SimpleTrigger
has already
fired.
protected boolean validateMisfireInstruction(int misfireInstruction)
validateMisfireInstruction
in class AbstractTrigger<SimpleTrigger>
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
.
WARNING: using MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT
with a trigger that has a non-null end-time may cause the trigger to
never fire again if the end-time arrived during the misfire time span.
> 0
, then the instruction
will be interpreted as MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT
.
If the misfire instruction is set to
Trigger.MISFIRE_INSTRUCTION_SKIP_TO_NEXT_FIRE_AFTER_CURRENT_DATE
then the behavior will be identical to
updateAfterMisfire
in interface OperableTrigger
updateAfterMisfire
in class AbstractTrigger<SimpleTrigger>
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 interface OperableTrigger
triggered
in class AbstractTrigger<SimpleTrigger>
AbstractTrigger.executionComplete(JobExecutionContext, JobExecutionException)
public void updateWithNewCalendar(Calendar calendar, long misfireThreshold)
AbstractTrigger
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
updateWithNewCalendar
in class AbstractTrigger<SimpleTrigger>
org.quartz.Trigger#updateWithNewCalendar(org.quartz.Calendar, long)
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 interface OperableTrigger
computeFirstFireTime
in class AbstractTrigger<SimpleTrigger>
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 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
getNextFireTime
in class AbstractTrigger<SimpleTrigger>
TriggerUtils#computeFireTimesBetween(Trigger, Calendar, Date, Date)
public java.util.Date getPreviousFireTime()
Returns the previous time at which the SimpleTrigger
fired. If the trigger has not yet fired, null
will be
returned.
getPreviousFireTime
in interface Trigger
getPreviousFireTime
in class AbstractTrigger<SimpleTrigger>
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.
setNextFireTime
in interface OperableTrigger
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.
setPreviousFireTime
in interface OperableTrigger
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 interface Trigger
getFireTimeAfter
in class AbstractTrigger<SimpleTrigger>
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 interface Trigger
getFinalFireTime
in class AbstractTrigger<SimpleTrigger>
public boolean mayFireAgain()
Determines whether or not the SimpleTrigger
will occur
again.
mayFireAgain
in interface Trigger
mayFireAgain
in class AbstractTrigger<SimpleTrigger>
public void validate() throws SchedulerException
Validates whether the properties of the JobDetail
are
valid for submission into a Scheduler
.
validate
in interface OperableTrigger
validate
in class AbstractTrigger<SimpleTrigger>
java.lang.IllegalStateException
- if a required property (such as Name, Group, Class) is not
set.
SchedulerException
public boolean hasAdditionalProperties()
hasAdditionalProperties
in interface CoreTrigger
public ScheduleBuilder<SimpleTrigger> getScheduleBuilder()
ScheduleBuilder
that is configured to produce a
schedule identical to this trigger's schedule.
getScheduleBuilder
in interface Trigger
getScheduleBuilder
in class AbstractTrigger<SimpleTrigger>
AbstractTrigger.getTriggerBuilder()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |