|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.quartz.impl.triggers.AbstractTrigger<DailyTimeIntervalTrigger> org.quartz.impl.triggers.DailyTimeIntervalTriggerImpl
public class DailyTimeIntervalTriggerImpl
A concrete implementation of DailyTimeIntervalTrigger that is used to fire a
based upon daily repeating time intervals.
JobDetail
The trigger will fire every N (see setRepeatInterval(int)
) seconds, minutes or hours
(see #setRepeatIntervalUnit(IntervalUnit)
) during a given time window on specified days of the week.
For example#1, a trigger can be set to fire every 72 minutes between 8:00 and 11:00 everyday. It's fire times would be 8:00, 9:12, 10:24, then next day would repeat: 8:00, 9:12, 10:24 again.
For example#2, a trigger can be set to fire every 23 minutes between 9:20 and 16:47 Monday through Friday.
On each day, the starting fire time is reset to startTimeOfDay value, and then it will add repeatInterval value to it until the endTimeOfDay is reached. If you set daysOfWeek values, then fire time will only occur during those week days period. Again, remember this trigger will reset fire time each day with startTimeOfDay, regardless of your interval or endTimeOfDay!
The default values for fields if not set are: startTimeOfDay defaults to 00:00:00, the endTimeOfDay default to 23:59:59, and daysOfWeek is default to every day. The startTime default to current time-stamp now, while endTime has not value.
If startTime is before startTimeOfDay, then startTimeOfDay will be used and startTime has no affect. Else if startTime is after startTimeOfDay, then the first fire time for that day will be the next interval after the startTime. For example, if you set startingTimeOfDay=9am, endingTimeOfDay=11am, interval=15 mins, and startTime=9:33am, then the next fire time will be 9:45pm. Note also that if you do not set startTime value, the trigger builder will default to current time, and current time maybe before or after the startTimeOfDay! So be aware how you set your startTime.
This trigger also supports "repeatCount" feature to end the trigger fire time after a certain number of count is reached. Just as the SimpleTrigger, setting repeatCount=0 means trigger will fire once only! Setting any positive count then the trigger will repeat count + 1 times. Unlike SimpleTrigger, the default value of repeatCount of this trigger is set to REPEAT_INDEFINITELY instead of 0 though.
DailyTimeIntervalTrigger, DailyTimeIntervalScheduleBuilder
,
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.DailyTimeIntervalTrigger |
---|
MISFIRE_INSTRUCTION_DO_NOTHING, MISFIRE_INSTRUCTION_FIRE_ONCE_NOW, REPEAT_INDEFINITELY |
Fields inherited from interface org.quartz.Trigger |
---|
DEFAULT_PRIORITY, MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY, MISFIRE_INSTRUCTION_SMART_POLICY |
Constructor Summary | |
---|---|
DailyTimeIntervalTriggerImpl()
Create a DailyTimeIntervalTrigger with no settings. |
|
DailyTimeIntervalTriggerImpl(String name,
Date startTime,
Date endTime,
TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DailyTimeIntervalTrigger that will occur at the given time,
and repeat at the the given interval until the given end time. |
|
DailyTimeIntervalTriggerImpl(String name,
String group,
Date startTime,
Date endTime,
TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DailyTimeIntervalTrigger that will occur at the given time,
and repeat at the the given interval until the given end time. |
|
DailyTimeIntervalTriggerImpl(String name,
String group,
String jobName,
String jobGroup,
Date startTime,
Date endTime,
TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DailyTimeIntervalTrigger that will occur at the given time,
fire the identified Job and repeat at the the given
interval until the given end time. |
|
DailyTimeIntervalTriggerImpl(String name,
String group,
TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DailyTimeIntervalTrigger that will occur immediately, and
repeat at the the given interval. |
|
DailyTimeIntervalTriggerImpl(String name,
TimeOfDay startTimeOfDay,
TimeOfDay endTimeOfDay,
DateBuilder.IntervalUnit intervalUnit,
int repeatInterval)
Create a DailyTimeIntervalTrigger that will occur immediately, and
repeat at the the given interval. |
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. |
Set<Integer> |
getDaysOfWeek()
The days of the week upon which to fire. |
Date |
getEndTime()
Get the time at which the DailyTimeIntervalTrigger should quit
repeating. |
TimeOfDay |
getEndTimeOfDay()
The time of day to complete firing at the given interval. |
Date |
getFinalFireTime()
Returns the final time at which the DailyTimeIntervalTrigger will
fire, if there is no end time set, null will be returned. |
Date |
getFireTimeAfter(Date afterTime)
Returns the next time at which the DailyTimeIntervalTrigger will
fire, after 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 DailyTimeIntervalTrigger
fired. |
int |
getRepeatCount()
Get the the number of times for interval this trigger should repeat, after which it will be automatically deleted. |
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<DailyTimeIntervalTrigger> |
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 DailyTimeIntervalTrigger should occur. |
TimeOfDay |
getStartTimeOfDay()
The time of day to start firing at the given interval. |
int |
getTimesTriggered()
Get the number of times the DateIntervalTrigger has already
fired. |
boolean |
hasAdditionalProperties()
This trigger has no additional properties besides what's defined in this class. |
boolean |
mayFireAgain()
Determines whether or not the DailyTimeIntervalTrigger will occur
again. |
void |
setDaysOfWeek(Set<Integer> daysOfWeek)
|
void |
setEndTime(Date endTime)
Set the time at which the DailyTimeIntervalTrigger should quit
repeating (and be automatically deleted). |
void |
setEndTimeOfDay(TimeOfDay endTimeOfDay)
|
void |
setNextFireTime(Date nextFireTime)
Set the next time at which the DailyTimeIntervalTrigger should fire. |
void |
setPreviousFireTime(Date previousFireTime)
Set the previous time at which the DailyTimeIntervalTrigger fired. |
void |
setRepeatCount(int repeatCount)
|
void |
setRepeatInterval(int repeatInterval)
set the the time interval that will be added to the DailyTimeIntervalTrigger '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(Date startTime)
Set the time at which the DailyTimeIntervalTrigger should occur. |
void |
setStartTimeOfDay(TimeOfDay startTimeOfDay)
|
void |
setTimesTriggered(int timesTriggered)
Set the number of times the DailyTimeIntervalTrigger 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 DailyTimeIntervalTrigger 's state based on the
MISFIRE_INSTRUCTION_XXX that was selected when the DailyTimeIntervalTrigger
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.DailyTimeIntervalTrigger |
---|
getTriggerBuilder |
Methods inherited from interface org.quartz.Trigger |
---|
compareTo, equals, getCalendarName, getDescription, getJobDataMap, getJobKey, getKey, getMisfireInstruction, getPriority |
Constructor Detail |
---|
public DailyTimeIntervalTriggerImpl()
Create a DailyTimeIntervalTrigger
with no settings.
public DailyTimeIntervalTriggerImpl(String name, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DailyTimeIntervalTrigger
that will occur immediately, and
repeat at the the given interval.
startTimeOfDay
- The TimeOfDay
that the repeating should begin occurring.endTimeOfDay
- The TimeOfDay
that the repeating should stop occurring.intervalUnit
- The repeat interval unit. The only intervals that are valid for this type of trigger are
DateBuilder.IntervalUnit.SECOND
, DateBuilder.IntervalUnit.MINUTE
, and DateBuilder.IntervalUnit.HOUR
.
IllegalArgumentException
- if an invalid IntervalUnit is given, or the repeat interval is zero or less.public DailyTimeIntervalTriggerImpl(String name, String group, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DailyTimeIntervalTrigger
that will occur immediately, and
repeat at the the given interval.
startTimeOfDay
- The TimeOfDay
that the repeating should begin occurring.endTimeOfDay
- The TimeOfDay
that the repeating should stop occurring.intervalUnit
- The repeat interval unit. The only intervals that are valid for this type of trigger are
DateBuilder.IntervalUnit.SECOND
, DateBuilder.IntervalUnit.MINUTE
, and DateBuilder.IntervalUnit.HOUR
.
IllegalArgumentException
- if an invalid IntervalUnit is given, or the repeat interval is zero or less.public DailyTimeIntervalTriggerImpl(String name, Date startTime, Date endTime, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DailyTimeIntervalTrigger
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.startTimeOfDay
- The TimeOfDay
that the repeating should begin occurring.endTimeOfDay
- The TimeOfDay
that the repeating should stop occurring.intervalUnit
- The repeat interval unit (minutes, days, months, etc).intervalUnit
- The repeat interval unit. The only intervals that are valid for this type of trigger are
DateBuilder.IntervalUnit.SECOND
, DateBuilder.IntervalUnit.MINUTE
, and DateBuilder.IntervalUnit.HOUR
.repeatInterval
- The number of milliseconds to pause between the repeat firing.
IllegalArgumentException
- if an invalid IntervalUnit is given, or the repeat interval is zero or less.public DailyTimeIntervalTriggerImpl(String name, String group, Date startTime, Date endTime, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DailyTimeIntervalTrigger
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.startTimeOfDay
- The TimeOfDay
that the repeating should begin occurring.endTimeOfDay
- The TimeOfDay
that the repeating should stop occurring.intervalUnit
- The repeat interval unit. The only intervals that are valid for this type of trigger are
DateBuilder.IntervalUnit.SECOND
, DateBuilder.IntervalUnit.MINUTE
, and DateBuilder.IntervalUnit.HOUR
.repeatInterval
- The number of milliseconds to pause between the repeat firing.
IllegalArgumentException
- if an invalid IntervalUnit is given, or the repeat interval is zero or less.public DailyTimeIntervalTriggerImpl(String name, String group, String jobName, String jobGroup, Date startTime, Date endTime, TimeOfDay startTimeOfDay, TimeOfDay endTimeOfDay, DateBuilder.IntervalUnit intervalUnit, int repeatInterval)
Create a DailyTimeIntervalTrigger
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.startTimeOfDay
- The TimeOfDay
that the repeating should begin occurring.endTimeOfDay
- The TimeOfDay
that the repeating should stop occurring.intervalUnit
- The repeat interval unit. The only intervals that are valid for this type of trigger are
DateBuilder.IntervalUnit.SECOND
, DateBuilder.IntervalUnit.MINUTE
, and DateBuilder.IntervalUnit.HOUR
.repeatInterval
- The number of milliseconds to pause between the repeat firing.
IllegalArgumentException
- if an invalid IntervalUnit is given, or the repeat interval is zero or less.Method Detail |
---|
public Date getStartTime()
Get the time at which the DailyTimeIntervalTrigger
should occur. It defaults to
the getStartTimeOfDay of current day.
getStartTime
in interface Trigger
getStartTime
in class AbstractTrigger<DailyTimeIntervalTrigger>
public void setStartTime(Date startTime)
Set the time at which the DailyTimeIntervalTrigger
should occur.
setStartTime
in interface org.quartz.spi.MutableTrigger
setStartTime
in class AbstractTrigger<DailyTimeIntervalTrigger>
IllegalArgumentException
- if startTime is null
.public Date getEndTime()
Get the time at which the DailyTimeIntervalTrigger
should quit
repeating.
getEndTime
in interface Trigger
getEndTime
in class AbstractTrigger<DailyTimeIntervalTrigger>
getFinalFireTime()
public void setEndTime(Date endTime)
Set the time at which the DailyTimeIntervalTrigger
should quit
repeating (and be automatically deleted).
setEndTime
in interface org.quartz.spi.MutableTrigger
setEndTime
in class AbstractTrigger<DailyTimeIntervalTrigger>
IllegalArgumentException
- if endTime is before start time.TriggerUtils#computeEndTimeToAllowParticularNumberOfFirings(AbstractTrigger, Calendar, int)
public DateBuilder.IntervalUnit getRepeatIntervalUnit()
DailyTimeIntervalTrigger
Get the interval unit - the time unit on with the interval applies.
The only intervals that are valid for this type of trigger are DateBuilder.IntervalUnit.SECOND
,
DateBuilder.IntervalUnit.MINUTE
, and DateBuilder.IntervalUnit.HOUR
.
getRepeatIntervalUnit
in interface DailyTimeIntervalTrigger
public void setRepeatIntervalUnit(DateBuilder.IntervalUnit intervalUnit)
Set the interval unit - the time unit on with the interval applies.
intervalUnit
- The repeat interval unit. The only intervals that are valid for this type of trigger are
DateBuilder.IntervalUnit.SECOND
, DateBuilder.IntervalUnit.MINUTE
, and DateBuilder.IntervalUnit.HOUR
.public int getRepeatInterval()
DailyTimeIntervalTrigger
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 DailyTimeIntervalTrigger
public void setRepeatInterval(int repeatInterval)
set the the time interval that will be added to the DailyTimeIntervalTrigger
's
fire time (in the set repeat interval unit) in order to calculate the time of the
next trigger repeat.
IllegalArgumentException
- if repeatInterval is < 1public int getTimesTriggered()
DailyTimeIntervalTrigger
Get the number of times the DateIntervalTrigger
has already
fired.
getTimesTriggered
in interface DailyTimeIntervalTrigger
public void setTimesTriggered(int timesTriggered)
Set the number of times the DailyTimeIntervalTrigger
has already
fired.
protected boolean validateMisfireInstruction(int misfireInstruction)
validateMisfireInstruction
in class AbstractTrigger<DailyTimeIntervalTrigger>
public void updateAfterMisfire(Calendar cal)
Updates the DailyTimeIntervalTrigger
's state based on the
MISFIRE_INSTRUCTION_XXX that was selected when the DailyTimeIntervalTrigger
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 org.quartz.spi.OperableTrigger
updateAfterMisfire
in class AbstractTrigger<DailyTimeIntervalTrigger>
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 org.quartz.spi.OperableTrigger
triggered
in class AbstractTrigger<DailyTimeIntervalTrigger>
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 org.quartz.spi.OperableTrigger
updateWithNewCalendar
in class AbstractTrigger<DailyTimeIntervalTrigger>
org.quartz.Trigger#updateWithNewCalendar(org.quartz.Calendar, long)
public 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 org.quartz.spi.OperableTrigger
computeFirstFireTime
in class AbstractTrigger<DailyTimeIntervalTrigger>
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 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<DailyTimeIntervalTrigger>
TriggerUtils#computeFireTimesBetween(AbstractTrigger, Calendar, Date, Date)
public Date getPreviousFireTime()
Returns the previous time at which the DailyTimeIntervalTrigger
fired. If the trigger has not yet fired, null
will be
returned.
getPreviousFireTime
in interface Trigger
getPreviousFireTime
in class AbstractTrigger<DailyTimeIntervalTrigger>
public void setNextFireTime(Date nextFireTime)
Set the next time at which the DailyTimeIntervalTrigger
should fire.
This method should not be invoked by client code.
setNextFireTime
in interface org.quartz.spi.OperableTrigger
public void setPreviousFireTime(Date previousFireTime)
Set the previous time at which the DailyTimeIntervalTrigger
fired.
This method should not be invoked by client code.
setPreviousFireTime
in interface org.quartz.spi.OperableTrigger
public Date getFireTimeAfter(Date afterTime)
Returns the next time at which the DailyTimeIntervalTrigger
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<DailyTimeIntervalTrigger>
public Date getFinalFireTime()
Returns the final time at which the DailyTimeIntervalTrigger
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<DailyTimeIntervalTrigger>
public boolean mayFireAgain()
Determines whether or not the DailyTimeIntervalTrigger
will occur
again.
mayFireAgain
in interface Trigger
mayFireAgain
in class AbstractTrigger<DailyTimeIntervalTrigger>
public void validate() throws SchedulerException
Validates whether the properties of the JobDetail
are
valid for submission into a Scheduler
.
validate
in interface org.quartz.spi.OperableTrigger
validate
in class AbstractTrigger<DailyTimeIntervalTrigger>
IllegalStateException
- if a required property (such as Name, Group, Class) is not
set.
SchedulerException
public Set<Integer> getDaysOfWeek()
getDaysOfWeek
in interface DailyTimeIntervalTrigger
Calendar.SUNDAY
- Calendar.SATURDAY
.public void setDaysOfWeek(Set<Integer> daysOfWeek)
public TimeOfDay getStartTimeOfDay()
getStartTimeOfDay
in interface DailyTimeIntervalTrigger
public void setStartTimeOfDay(TimeOfDay startTimeOfDay)
public TimeOfDay getEndTimeOfDay()
getEndTimeOfDay
in interface DailyTimeIntervalTrigger
public void setEndTimeOfDay(TimeOfDay endTimeOfDay)
public ScheduleBuilder<DailyTimeIntervalTrigger> getScheduleBuilder()
ScheduleBuilder
that is configured to produce a
schedule identical to this trigger's schedule.
getScheduleBuilder
in interface Trigger
getScheduleBuilder
in class AbstractTrigger<DailyTimeIntervalTrigger>
AbstractTrigger.getTriggerBuilder()
public boolean hasAdditionalProperties()
hasAdditionalProperties
in interface CoreTrigger
public int getRepeatCount()
DailyTimeIntervalTrigger
Get the the number of times for interval this trigger should repeat, after which it will be automatically deleted.
getRepeatCount
in interface DailyTimeIntervalTrigger
DailyTimeIntervalTrigger.REPEAT_INDEFINITELY
public void setRepeatCount(int repeatCount)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |