Interface CalendarIntervalTrigger
-
- All Superinterfaces:
java.lang.Cloneable
,java.lang.Comparable<Trigger>
,java.io.Serializable
,Trigger
- All Known Implementing Classes:
CalendarIntervalTriggerImpl
public interface CalendarIntervalTrigger extends Trigger
A concrete
that is used to fire aTrigger
based upon repeating calendar time intervals.JobDetail
The trigger will fire every N (see
getRepeatInterval()
) units of calendar time (seegetRepeatIntervalUnit()
) as specified in the trigger's definition. This trigger can achieve schedules that are not possible withSimpleTrigger
(e.g because months are not a fixed number of seconds) orCronTrigger
(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 astartTime
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 unitMONTH
and interval1
, 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 useCronTrigger
.- Author:
- James House
- See Also:
TriggerBuilder
,CalendarIntervalScheduleBuilder
,SimpleScheduleBuilder
,CronScheduleBuilder
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.quartz.Trigger
Trigger.CompletedExecutionInstruction, Trigger.TriggerState, Trigger.TriggerTimeComparator
-
-
Field Summary
Fields Modifier and Type Field Description static int
MISFIRE_INSTRUCTION_DO_NOTHING
Instructs the
that upon a mis-fire situation, theScheduler
wants to have it's next-fire-time updated to the next time in the schedule after the current time (taking into account any associatedCalendarIntervalTrigger
, but it does not want to be fired now.Calendar
static int
MISFIRE_INSTRUCTION_FIRE_ONCE_NOW
Instructs the
that upon a mis-fire situation, theScheduler
wants to be fired now byCalendarIntervalTrigger
Scheduler
.-
Fields inherited from interface org.quartz.Trigger
DEFAULT_PRIORITY, MISFIRE_INSTRUCTION_IGNORE_MISFIRE_POLICY, MISFIRE_INSTRUCTION_SMART_POLICY, serialVersionUID
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description int
getRepeatInterval()
Get the the time interval that will be added to theDateIntervalTrigger
'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.int
getTimesTriggered()
Get the number of times theDateIntervalTrigger
has already fired.java.util.TimeZone
getTimeZone()
Gets the time zone within which time calculations related to this trigger will be performed.TriggerBuilder<CalendarIntervalTrigger>
getTriggerBuilder()
Get aTriggerBuilder
that is configured to produce aTrigger
identical to this one.boolean
isPreserveHourOfDayAcrossDaylightSavings()
If intervals are a day or greater, this property (set to true) will cause the firing of the trigger to always occur at the same time of day, (the time of day of the startTime) regardless of daylight saving time transitions.boolean
isSkipDayIfHourDoesNotExist()
If intervals are a day or greater, and preserveHourOfDayAcrossDaylightSavings property is set to true, and the hour of the day does not exist on a given day for which the trigger would fire, the day will be skipped and the trigger advanced a second interval if this property is set to true.-
Methods inherited from interface org.quartz.Trigger
compareTo, equals, getCalendarName, getDescription, getEndTime, getFinalFireTime, getFireTimeAfter, getJobDataMap, getJobKey, getKey, getMisfireInstruction, getNextFireTime, getPreviousFireTime, getPriority, getScheduleBuilder, getStartTime, mayFireAgain
-
-
-
-
Field Detail
-
MISFIRE_INSTRUCTION_FIRE_ONCE_NOW
static final int MISFIRE_INSTRUCTION_FIRE_ONCE_NOW
Instructs the
that upon a mis-fire situation, theScheduler
wants to be fired now byCalendarIntervalTrigger
Scheduler
.- See Also:
- Constant Field Values
-
MISFIRE_INSTRUCTION_DO_NOTHING
static final int MISFIRE_INSTRUCTION_DO_NOTHING
Instructs the
that upon a mis-fire situation, theScheduler
wants to have it's next-fire-time updated to the next time in the schedule after the current time (taking into account any associatedCalendarIntervalTrigger
, but it does not want to be fired now.Calendar
- See Also:
- Constant Field Values
-
-
Method Detail
-
getRepeatIntervalUnit
DateBuilder.IntervalUnit getRepeatIntervalUnit()
Get the interval unit - the time unit on with the interval applies.
-
getRepeatInterval
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.
-
getTimesTriggered
int getTimesTriggered()
Get the number of times the
DateIntervalTrigger
has already fired.
-
getTimeZone
java.util.TimeZone getTimeZone()
Gets the time zone within which time calculations related to this trigger will be performed.
If null, the system default TimeZone will be used.
-
isPreserveHourOfDayAcrossDaylightSavings
boolean isPreserveHourOfDayAcrossDaylightSavings()
If intervals are a day or greater, this property (set to true) will cause the firing of the trigger to always occur at the same time of day, (the time of day of the startTime) regardless of daylight saving time transitions. Default value is false.For example, without the property set, your trigger may have a start time of 9:00 am on March 1st, and a repeat interval of 2 days. But after the daylight saving transition occurs, the trigger may start firing at 8:00 am every other day.
If however, the time of day does not exist on a given day to fire (e.g. 2:00 am in the United States on the days of daylight saving transition), the trigger will go ahead and fire one hour off on that day, and then resume the normal hour on other days. If you wish for the trigger to never fire at the "wrong" hour, then you should set the property skipDayIfHourDoesNotExist.
-
isSkipDayIfHourDoesNotExist
boolean isSkipDayIfHourDoesNotExist()
If intervals are a day or greater, and preserveHourOfDayAcrossDaylightSavings property is set to true, and the hour of the day does not exist on a given day for which the trigger would fire, the day will be skipped and the trigger advanced a second interval if this property is set to true. Defaults to false.CAUTION! If you enable this property, and your hour of day happens to be that of daylight savings transition (e.g. 2:00 am in the United States) and the trigger's interval would have had the trigger fire on that day, then you may actually completely miss a firing on the day of transition if that hour of day does not exist on that day! In such a case the next fire time of the trigger will be computed as double (if the interval is 2 days, then a span of 4 days between firings will occur).
-
getTriggerBuilder
TriggerBuilder<CalendarIntervalTrigger> getTriggerBuilder()
Description copied from interface:Trigger
Get aTriggerBuilder
that is configured to produce aTrigger
identical to this one.- Specified by:
getTriggerBuilder
in interfaceTrigger
- See Also:
Trigger.getScheduleBuilder()
-
-