|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.impl.triggers.AbstractTrigger org.quartz.impl.triggers.CalendarIntervalTriggerImpl
public class CalendarIntervalTriggerImpl
A concrete
that is used to fire a Trigger
based upon repeating calendar time intervals.JobDetail
The trigger will fire every N (see setRepeatInterval(int)
) units of calendar time
(see #setRepeatIntervalUnit(IntervalUnit)
) as specified in the trigger's definition.
This trigger can achieve schedules that are not possible with SimpleTrigger
(e.g
because months are not a fixed number of seconds) or CronTrigger
(e.g. because
"every 5 months" is not an even divisor of 12).
If you use an interval unit of MONTH
then care should be taken when setting
a startTime
value that is on a day near the end of the month. For example,
if you choose a start time that occurs on January 31st, and have a trigger with unit
MONTH
and interval 1
, then the next fire time will be February 28th,
and the next time after that will be March 28th - and essentially each subsequent firing will
occur on the 28th of the month, even if a 31st day exists. If you want a trigger that always
fires on the last day of the month - regardless of the number of days in the month,
you should use CronTrigger
.
Trigger
,
CronTrigger
,
SimpleTrigger
,
NthIncludedDayTrigger
,
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.CalendarIntervalTrigger |
---|
MISFIRE_INSTRUCTION_DO_NOTHING, MISFIRE_INSTRUCTION_FIRE_ONCE_NOW |
Fields inherited from interface org.quartz.Trigger |
---|
DEFAULT_PRIORITY, MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY, MISFIRE_INSTRUCTION_SMART_POLICY |
Constructor Summary | |
---|---|
CalendarIntervalTriggerImpl()
Create a DateIntervalTrigger with no settings. |
|
CalendarIntervalTriggerImpl(java.lang.String name,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DateIntervalTrigger that will occur immediately, and
repeat at the the given interval. |
|
CalendarIntervalTriggerImpl(java.lang.String name,
java.util.Date startTime,
java.util.Date endTime,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DateIntervalTrigger that will occur at the given time,
and repeat at the the given interval until the given end time. |
|
CalendarIntervalTriggerImpl(java.lang.String name,
java.lang.String group,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DateIntervalTrigger that will occur immediately, and
repeat at the the given interval. |
|
CalendarIntervalTriggerImpl(java.lang.String name,
java.lang.String group,
java.util.Date startTime,
java.util.Date endTime,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DateIntervalTrigger that will occur at the given time,
and repeat at the the given interval until the given end time. |
|
CalendarIntervalTriggerImpl(java.lang.String name,
java.lang.String group,
java.lang.String jobName,
java.lang.String jobGroup,
java.util.Date startTime,
java.util.Date endTime,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DateIntervalTrigger that will occur at the given time,
fire the identified Job and repeat at the the given
interval 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. |
java.util.Date |
getEndTime()
Get the time at which the DateIntervalTrigger should quit
repeating. |
java.util.Date |
getFinalFireTime()
Returns the final time at which the DateIntervalTrigger will
fire, if there is no end time set, null will be returned. |
java.util.Date |
getFireTimeAfter(java.util.Date afterTime)
Returns the next time at which the DateIntervalTrigger will
fire, after the given time. |
protected java.util.Date |
getFireTimeAfter(java.util.Date afterTime,
boolean ignoreEndTime)
|
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 DateIntervalTrigger
fired. |
int |
getRepeatInterval()
Get the the time interval that will be added to the DateIntervalTrigger 's
fire time (in the set repeat interval unit) in order to calculate the time of the
next trigger repeat. |
DateBuilder.IntervalUnit |
getRepeatIntervalUnit()
Get the interval unit - the time unit on with the interval applies. |
ScheduleBuilder<CalendarIntervalTrigger> |
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 DateIntervalTrigger should occur. |
int |
getTimesTriggered()
Get the number of times the DateIntervalTrigger has already
fired. |
boolean |
hasAdditionalProperties()
|
boolean |
mayFireAgain()
Determines whether or not the DateIntervalTrigger will occur
again. |
void |
setEndTime(java.util.Date endTime)
Set the time at which the DateIntervalTrigger should quit
repeating (and be automatically deleted). |
void |
setNextFireTime(java.util.Date nextFireTime)
Set the next time at which the DateIntervalTrigger should fire. |
void |
setPreviousFireTime(java.util.Date previousFireTime)
Set the previous time at which the DateIntervalTrigger fired. |
void |
setRepeatInterval(int repeatInterval)
set the the time interval that will be added to the DateIntervalTrigger 's
fire time (in the set repeat interval unit) in order to calculate the time of the
next trigger repeat. |
void |
setRepeatIntervalUnit(DateBuilder.IntervalUnit intervalUnit)
Set the interval unit - the time unit on with the interval applies. |
void |
setStartTime(java.util.Date startTime)
Set the time at which the DateIntervalTrigger should occur. |
void |
setTimesTriggered(int timesTriggered)
Set the number of times the DateIntervalTrigger 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 DateIntervalTrigger 's state based on the
MISFIRE_INSTRUCTION_XXX that was selected when the DateIntervalTrigger
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.CalendarIntervalTrigger |
---|
getTriggerBuilder |
Methods inherited from interface org.quartz.Trigger |
---|
compareTo, equals, getCalendarName, getDescription, getJobDataMap, getJobKey, getKey, getMisfireInstruction, getPriority |
Constructor Detail |
---|
public CalendarIntervalTriggerImpl()
Create a DateIntervalTrigger
with no settings.
public CalendarIntervalTriggerImpl(java.lang.String name, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DateIntervalTrigger
that will occur immediately, and
repeat at the the given interval.
public CalendarIntervalTriggerImpl(java.lang.String name, java.lang.String group, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DateIntervalTrigger
that will occur immediately, and
repeat at the the given interval.
public CalendarIntervalTriggerImpl(java.lang.String name, java.util.Date startTime, java.util.Date endTime, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DateIntervalTrigger
that will occur at the given time,
and repeat at the the given interval 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.intervalUnit
- The repeat interval unit (minutes, days, months, etc).repeatInterval
- The number of milliseconds to pause between the repeat firing.public CalendarIntervalTriggerImpl(java.lang.String name, java.lang.String group, java.util.Date startTime, java.util.Date endTime, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DateIntervalTrigger
that will occur at the given time,
and repeat at the the given interval 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.intervalUnit
- The repeat interval unit (minutes, days, months, etc).repeatInterval
- The number of milliseconds to pause between the repeat firing.public CalendarIntervalTriggerImpl(java.lang.String name, java.lang.String group, java.lang.String jobName, java.lang.String jobGroup, java.util.Date startTime, java.util.Date endTime, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DateIntervalTrigger
that will occur at the given time,
fire the identified Job
and repeat at the the given
interval 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.intervalUnit
- The repeat interval unit (minutes, days, months, etc).repeatInterval
- The number of milliseconds to pause between the repeat firing.Method Detail |
---|
public java.util.Date getStartTime()
Get the time at which the DateIntervalTrigger
should occur.
getStartTime
in interface Trigger
getStartTime
in class AbstractTrigger
public void setStartTime(java.util.Date startTime)
Set the time at which the DateIntervalTrigger
should occur.
setStartTime
in interface MutableTrigger
setStartTime
in class AbstractTrigger
java.lang.IllegalArgumentException
- if startTime is null
.public java.util.Date getEndTime()
Get the time at which the DateIntervalTrigger
should quit
repeating.
getEndTime
in interface Trigger
getEndTime
in class AbstractTrigger
getFinalFireTime()
public void setEndTime(java.util.Date endTime)
Set the time at which the DateIntervalTrigger
should quit
repeating (and be automatically deleted).
setEndTime
in interface MutableTrigger
setEndTime
in class AbstractTrigger
java.lang.IllegalArgumentException
- if endTime is before start time.TriggerUtils#computeEndTimeToAllowParticularNumberOfFirings(AbstractTrigger, Calendar, int)
public DateBuilder.IntervalUnit getRepeatIntervalUnit()
CalendarIntervalTrigger
Get the interval unit - the time unit on with the interval applies.
getRepeatIntervalUnit
in interface CalendarIntervalTrigger
public void setRepeatIntervalUnit(DateBuilder.IntervalUnit intervalUnit)
Set the interval unit - the time unit on with the interval applies.
public int getRepeatInterval()
CalendarIntervalTrigger
Get the the time interval that will be added to the DateIntervalTrigger
's
fire time (in the set repeat interval unit) in order to calculate the time of the
next trigger repeat.
getRepeatInterval
in interface CalendarIntervalTrigger
public void setRepeatInterval(int repeatInterval)
set the the time interval that will be added to the DateIntervalTrigger
's
fire time (in the set repeat interval unit) in order to calculate the time of the
next trigger repeat.
java.lang.IllegalArgumentException
- if repeatInterval is < 1public int getTimesTriggered()
CalendarIntervalTrigger
Get the number of times the DateIntervalTrigger
has already
fired.
getTimesTriggered
in interface CalendarIntervalTrigger
public void setTimesTriggered(int timesTriggered)
Set the number of times the DateIntervalTrigger
has already
fired.
protected boolean validateMisfireInstruction(int misfireInstruction)
validateMisfireInstruction
in class AbstractTrigger
public void updateAfterMisfire(Calendar cal)
Updates the DateIntervalTrigger
's state based on the
MISFIRE_INSTRUCTION_XXX that was selected when the DateIntervalTrigger
was created.
If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY,
then the following scheme will be used:
MISFIRE_INSTRUCTION_FIRE_ONCE_NOW
updateAfterMisfire
in interface OperableTrigger
updateAfterMisfire
in class AbstractTrigger
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
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
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
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
TriggerUtils#computeFireTimesBetween(AbstractTrigger, Calendar, Date, Date)
public java.util.Date getPreviousFireTime()
Returns the previous time at which the DateIntervalTrigger
fired. If the trigger has not yet fired, null
will be
returned.
getPreviousFireTime
in interface Trigger
getPreviousFireTime
in class AbstractTrigger
public void setNextFireTime(java.util.Date nextFireTime)
Set the next time at which the DateIntervalTrigger
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 DateIntervalTrigger
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 DateIntervalTrigger
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
protected java.util.Date getFireTimeAfter(java.util.Date afterTime, boolean ignoreEndTime)
public java.util.Date getFinalFireTime()
Returns the final time at which the DateIntervalTrigger
will
fire, if there is no end time set, null will be returned.
Note that the return time may be in the past.
getFinalFireTime
in interface Trigger
getFinalFireTime
in class AbstractTrigger
public boolean mayFireAgain()
Determines whether or not the DateIntervalTrigger
will occur
again.
mayFireAgain
in interface Trigger
mayFireAgain
in class AbstractTrigger
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
java.lang.IllegalStateException
- if a required property (such as Name, Group, Class) is not
set.
SchedulerException
public ScheduleBuilder<CalendarIntervalTrigger> getScheduleBuilder()
ScheduleBuilder
that is configured to produce a
schedule identical to this trigger's schedule.
getScheduleBuilder
in interface Trigger
getScheduleBuilder
in class AbstractTrigger
AbstractTrigger.getTriggerBuilder()
public boolean hasAdditionalProperties()
hasAdditionalProperties
in interface CoreTrigger
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |