|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
org.quartz.impl.triggers Class SimpleTriggerImpl
java.lang.Objectorg.quartz.impl.triggers.AbstractTrigger<SimpleTrigger>
org.quartz.impl.triggers.SimpleTriggerImpl
- All Implemented Interfaces:
- Serializable, Cloneable, Comparable<Trigger>, CoreTrigger, SimpleTrigger, org.quartz.spi.MutableTrigger, org.quartz.spi.OperableTrigger, Trigger
public class SimpleTriggerImpl
- extends AbstractTrigger<SimpleTrigger>
- implements SimpleTrigger, CoreTrigger
A concrete Trigger that is used to fire a JobDetail
at a given moment in time, and optionally repeated at a specified interval.
- Author:
- James House, contributions by Lieven Govaerts of Ebitec Nv, Belgium.
- See Also:
Trigger,CronTrigger,TriggerUtils, Serialized Form
| Nested 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(String name)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
Date startTime)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
Date startTime,
Date endTime,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
String group)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
String group,
Date startTime)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
String group,
Date startTime,
Date endTime,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
String group,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
SimpleTriggerImpl(String name,
String group,
String jobName,
String jobGroup,
Date startTime,
Date endTime,
int repeatCount,
long repeatInterval)
Deprecated. use a TriggerBuilder instead |
|
| Method Summary | |
|---|---|
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(Date start,
Date end)
|
Date |
getEndTime()
Get the time at which the SimpleTrigger should quit
repeating - even if repeastCount isn't yet satisfied. |
Date |
getFinalFireTime()
Returns the final time at which the SimpleTrigger will
fire, if repeatCount is REPEAT_INDEFINITELY, null will be returned. |
Date |
getFireTimeAfter(Date afterTime)
Returns the next time at which the SimpleTrigger will
fire, after the given time. |
Date |
getFireTimeBefore(Date end)
Returns the last time at which the SimpleTrigger will
fire, before the given time. |
Date |
getNextFireTime()
Returns the next time at which the Trigger is scheduled to fire. |
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. |
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(Date endTime)
Set the time at which the SimpleTrigger should quit
repeating (and be automatically deleted). |
void |
setNextFireTime(Date nextFireTime)
Set the next time at which the SimpleTrigger should fire. |
void |
setPreviousFireTime(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(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 Scheduler 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 |
|---|
SimpleTriggerImpl
public SimpleTriggerImpl()
Create a
SimpleTriggerwith no settings.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur immediately, and not repeat.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, String group)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur immediately, and not repeat.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, int repeatCount, long repeatInterval)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur immediately, and repeat at the the given interval the given number of times.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, String group, int repeatCount, long repeatInterval)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur immediately, and repeat at the the given interval the given number of times.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, Date startTime)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur at the given time, and not repeat.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, String group, Date startTime)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur at the given time, and not repeat.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, Date startTime, Date endTime, int repeatCount, long repeatInterval)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur at the given time, and repeat at the the given interval the given number of times, or until the given end time.- Parameters:
startTime- ADateset to the time for theTriggerto fire.endTime- ADateset to the time for theTriggerto quit repeat firing.repeatCount- The number of times for theTriggerto repeat firing, useSimpleTrigger.REPEAT_INDEFINITELYfor unlimited times.repeatInterval- The number of milliseconds to pause between the repeat firing.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, String group, Date startTime, Date endTime, int repeatCount, long repeatInterval)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur at the given time, and repeat at the the given interval the given number of times, or until the given end time.- Parameters:
startTime- ADateset to the time for theTriggerto fire.endTime- ADateset to the time for theTriggerto quit repeat firing.repeatCount- The number of times for theTriggerto repeat firing, useSimpleTrigger.REPEAT_INDEFINITELYfor unlimited times.repeatInterval- The number of milliseconds to pause between the repeat firing.
SimpleTriggerImpl
@Deprecated public SimpleTriggerImpl(String name, String group, String jobName, String jobGroup, Date startTime, Date endTime, int repeatCount, long repeatInterval)
- Deprecated. use a TriggerBuilder instead
Create a
SimpleTriggerthat will occur at the given time, fire the identifiedJoband repeat at the the given interval the given number of times, or until the given end time.- Parameters:
startTime- ADateset to the time for theTriggerto fire.endTime- ADateset to the time for theTriggerto quit repeat firing.repeatCount- The number of times for theTriggerto repeat firing, useSimpleTrigger.REPEAT_INDEFINITELYfor unlimitted times.repeatInterval- The number of milliseconds to pause between the repeat firing.
| Method Detail |
|---|
getStartTime
public Date getStartTime()
Get the time at which the
SimpleTriggershould occur.- Specified by:
getStartTimein interfaceTrigger- Specified by:
getStartTimein classAbstractTrigger<SimpleTrigger>
setStartTime
public void setStartTime(Date startTime)
Set the time at which the
SimpleTriggershould occur.- Specified by:
setStartTimein interfaceorg.quartz.spi.MutableTrigger- Specified by:
setStartTimein classAbstractTrigger<SimpleTrigger>
- Throws:
IllegalArgumentException- if startTime isnull.
getEndTime
public Date getEndTime()
Get the time at which the
SimpleTriggershould quit repeating - even if repeastCount isn't yet satisfied.- Specified by:
getEndTimein interfaceTrigger- Specified by:
getEndTimein classAbstractTrigger<SimpleTrigger>
- See Also:
getFinalFireTime()
setEndTime
public void setEndTime(Date endTime)
Set the time at which the
SimpleTriggershould quit repeating (and be automatically deleted).- Specified by:
setEndTimein interfaceorg.quartz.spi.MutableTrigger- Specified by:
setEndTimein classAbstractTrigger<SimpleTrigger>
- Throws:
IllegalArgumentException- if endTime is before start time.- See Also:
TriggerUtils#computeEndTimeToAllowParticularNumberOfFirings(AbstractTrigger, Calendar, int)
getRepeatCount
public int getRepeatCount()
- Description copied from interface:
SimpleTrigger Get the the number of times the
SimpleTriggershould repeat, after which it will be automatically deleted.- Specified by:
getRepeatCountin interfaceSimpleTrigger
- See Also:
SimpleTrigger.REPEAT_INDEFINITELY
setRepeatCount
public void setRepeatCount(int repeatCount)
Set the the number of time the
SimpleTriggershould repeat, after which it will be automatically deleted.- Throws:
IllegalArgumentException- if repeatCount is < 0- See Also:
SimpleTrigger.REPEAT_INDEFINITELY
getRepeatInterval
public long getRepeatInterval()
- Description copied from interface:
SimpleTrigger Get the the time interval (in milliseconds) at which the
SimpleTriggershould repeat.- Specified by:
getRepeatIntervalin interfaceSimpleTrigger
setRepeatInterval
public void setRepeatInterval(long repeatInterval)
Set the the time interval (in milliseconds) at which the
SimpleTriggershould repeat.- Throws:
IllegalArgumentException- if repeatInterval is <= 0
getTimesTriggered
public int getTimesTriggered()
Get the number of times the
SimpleTriggerhas already fired.- Specified by:
getTimesTriggeredin interfaceSimpleTrigger
setTimesTriggered
public void setTimesTriggered(int timesTriggered)
Set the number of times the
SimpleTriggerhas already fired.
validateMisfireInstruction
protected boolean validateMisfireInstruction(int misfireInstruction)
- Specified by:
validateMisfireInstructionin classAbstractTrigger<SimpleTrigger>
updateAfterMisfire
public void updateAfterMisfire(Calendar cal)
Updates the
SimpleTrigger's state based on the MISFIRE_INSTRUCTION_XXX that was selected when theSimpleTriggerwas created.If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, then the following scheme will be used:
- If the Repeat Count is
0, then the instruction will be interpreted asMISFIRE_INSTRUCTION_FIRE_NOW. - If the Repeat Count is
REPEAT_INDEFINITELY, then the instruction will be interpreted asMISFIRE_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. - If the Repeat Count is
> 0, then the instruction will be interpreted asMISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT.
If the misfire instruction is set to
Trigger.MISFIRE_INSTRUCTION_SKIP_TO_NEXT_FIRE_AFTER_CURRENT_DATEthen the behavior will be identical to- If the Repeat Count is
- Specified by:
updateAfterMisfirein interfaceorg.quartz.spi.OperableTrigger- Specified by:
updateAfterMisfirein classAbstractTrigger<SimpleTrigger>
triggered
public void triggered(Calendar calendar)
Called when the
Schedulerhas decided to 'fire' the trigger (execute the associatedJob), in order to give theTriggera chance to update itself for its next triggering (if any).- Specified by:
triggeredin interfaceorg.quartz.spi.OperableTrigger- Specified by:
triggeredin classAbstractTrigger<SimpleTrigger>
updateWithNewCalendar
public void updateWithNewCalendar(Calendar calendar, long misfireThreshold)
- Description copied from class:
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 associatedCalendar(the state should be updated so that it's next fire time is appropriate given the Calendar's new settings).- Specified by:
updateWithNewCalendarin interfaceorg.quartz.spi.OperableTrigger- Specified by:
updateWithNewCalendarin classAbstractTrigger<SimpleTrigger>
- See Also:
org.quartz.Trigger#updateWithNewCalendar(org.quartz.Calendar, long)
computeFirstFireTime
public Date computeFirstFireTime(Calendar calendar)
Called by the scheduler at the time a
Triggeris first added to the scheduler, in order to have theTriggercompute its first fire time, based on any associated calendar.After this method has been called,
getNextFireTime()should return a valid answer.- Specified by:
computeFirstFireTimein interfaceorg.quartz.spi.OperableTrigger- Specified by:
computeFirstFireTimein classAbstractTrigger<SimpleTrigger>
- Returns:
- the first time at which the
Triggerwill be fired by the scheduler, which is also the same valuegetNextFireTime()will return (until after the first firing of theTrigger).
getNextFireTime
public Date getNextFireTime()
Returns the next time at which the
Triggeris scheduled to fire. If the trigger will not fire again,nullwill 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
Triggerhas been added to the scheduler.- Specified by:
getNextFireTimein interfaceTrigger- Specified by:
getNextFireTimein classAbstractTrigger<SimpleTrigger>
- See Also:
TriggerUtils#computeFireTimesBetween(Trigger, Calendar, Date, Date)
getPreviousFireTime
public Date getPreviousFireTime()
Returns the previous time at which the
SimpleTriggerfired. If the trigger has not yet fired,nullwill be returned.- Specified by:
getPreviousFireTimein interfaceTrigger- Specified by:
getPreviousFireTimein classAbstractTrigger<SimpleTrigger>
setNextFireTime
public void setNextFireTime(Date nextFireTime)
Set the next time at which the
SimpleTriggershould fire.This method should not be invoked by client code.
- Specified by:
setNextFireTimein interfaceorg.quartz.spi.OperableTrigger
setPreviousFireTime
public void setPreviousFireTime(Date previousFireTime)
Set the previous time at which the
SimpleTriggerfired.This method should not be invoked by client code.
- Specified by:
setPreviousFireTimein interfaceorg.quartz.spi.OperableTrigger
getFireTimeAfter
public Date getFireTimeAfter(Date afterTime)
Returns the next time at which the
SimpleTriggerwill fire, after the given time. If the trigger will not fire after the given time,nullwill be returned.- Specified by:
getFireTimeAfterin interfaceTrigger- Specified by:
getFireTimeAfterin classAbstractTrigger<SimpleTrigger>
getFireTimeBefore
public Date getFireTimeBefore(Date end)
Returns the last time at which the
SimpleTriggerwill fire, before the given time. If the trigger will not fire before the given time,nullwill be returned.
computeNumTimesFiredBetween
public int computeNumTimesFiredBetween(Date start, Date end)
getFinalFireTime
public Date getFinalFireTime()
Returns the final time at which the
SimpleTriggerwill fire, if repeatCount is REPEAT_INDEFINITELY, null will be returned.Note that the return time may be in the past.
- Specified by:
getFinalFireTimein interfaceTrigger- Specified by:
getFinalFireTimein classAbstractTrigger<SimpleTrigger>
mayFireAgain
public boolean mayFireAgain()
Determines whether or not the
SimpleTriggerwill occur again.- Specified by:
mayFireAgainin interfaceTrigger- Specified by:
mayFireAgainin classAbstractTrigger<SimpleTrigger>
validate
public void validate()
throws SchedulerException
Validates whether the properties of the
JobDetailare valid for submission into aScheduler.- Specified by:
validatein interfaceorg.quartz.spi.OperableTrigger- Overrides:
validatein classAbstractTrigger<SimpleTrigger>
- Throws:
IllegalStateException- if a required property (such as Name, Group, Class) is not set.SchedulerException
hasAdditionalProperties
public 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.
- Specified by:
hasAdditionalPropertiesin interfaceCoreTrigger
getScheduleBuilder
public ScheduleBuilder<SimpleTrigger> getScheduleBuilder()
- Get a
ScheduleBuilderthat is configured to produce a schedule identical to this trigger's schedule. - Specified by:
getScheduleBuilderin interfaceTrigger- Specified by:
getScheduleBuilderin classAbstractTrigger<SimpleTrigger>
- See Also:
AbstractTrigger.getTriggerBuilder()
|
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Copyright 2001-2011, Terracotta, Inc.
