Class CronTrigger
- java.lang.Object
-
- org.drools.core.time.impl.CronTrigger
-
- All Implemented Interfaces:
Serializable,Trigger
public class CronTrigger extends Object implements Trigger
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected static intYEAR_TO_GIVEUP_SCHEDULING_AT
-
Constructor Summary
Constructors Constructor Description CronTrigger()CronTrigger(long timestamp, Date startTime, Date endTime, int repeatLimit, String cronExpression, String[] calendarNames, org.kie.api.runtime.Calendars calendars)CronTrigger(long timestamp, Date startTime, Date endTime, int repeatLimit, CronExpression cronExpression, String[] calendarNames, org.kie.api.runtime.Calendars calendars)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CronExpressiondetermineCronExpression(String cronExpression)String[]getCalendarNames()org.kie.api.runtime.CalendarsgetCalendars()CronExpressiongetCronEx()DategetEndTime()Get the time at which theCronTriggershould quit repeating - even if repeastCount isn't yet satisfied.DategetNextFireTime()Returns the next time at which theTriggeris scheduled to fire.DategetPreviousFireTime()Returns the previous time at which theCronTriggerfired.intgetRepeatCount()intgetRepeatLimit()DategetStartTime()protected DategetTimeAfter(Date afterTime)TimeZonegetTimeZone()Returns the time zone for which thecronExpressionof thisCronTriggerwill be resolved.DatehasNextFireTime()This method is used to query the trigger about the existence of a possible next fire time, but WITHOUT changing any internal state of the trigger.DatenextFireTime()This method returns the date of the next fire time and updates the internal state of the Trigger to the following fire time if one exists.voidsetCalendarNames(String[] calendarNames)voidsetCalendars(org.kie.api.runtime.Calendars calendars)voidsetCronEx(CronExpression cronEx)voidsetCronExpression(String cronExpression)voidsetCronExpression(CronExpression cronExpression)voidsetEndTime(Date endTime)voidsetFirstFireTimeAfter()Returns the next time at which theCronTriggerwill fire, after the given time.voidsetNextFireTime(Date nextFireTime)Sets the next time at which theCronTriggerwill fire.voidsetPreviousFireTime(Date previousFireTime)Set the previous time at which theCronTriggerfired.voidsetRepeatCount(int repeatCount)voidsetRepeatLimit(int repeatLimit)voidsetStartTime(Date startTime)voidsetTimeZone(TimeZone timeZone)Sets the time zone for which thecronExpressionof thisCronTriggerwill be resolved.voidupdateToNextIncludeDate()-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.drools.core.time.Trigger
initialize
-
-
-
-
Field Detail
-
YEAR_TO_GIVEUP_SCHEDULING_AT
protected static final int YEAR_TO_GIVEUP_SCHEDULING_AT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CronTrigger
public CronTrigger()
-
CronTrigger
public CronTrigger(long timestamp, Date startTime, Date endTime, int repeatLimit, String cronExpression, String[] calendarNames, org.kie.api.runtime.Calendars calendars)
-
CronTrigger
public CronTrigger(long timestamp, Date startTime, Date endTime, int repeatLimit, CronExpression cronExpression, String[] calendarNames, org.kie.api.runtime.Calendars calendars)
-
-
Method Detail
-
getStartTime
public Date getStartTime()
-
setStartTime
public void setStartTime(Date startTime)
-
getEndTime
public Date getEndTime()
Get the time at which the
CronTriggershould quit repeating - even if repeastCount isn't yet satisfied.
-
setEndTime
public void setEndTime(Date endTime)
-
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.
-
getPreviousFireTime
public Date getPreviousFireTime()
Returns the previous time at which the
CronTriggerfired. If the trigger has not yet fired,nullwill be returned.
-
setNextFireTime
public void setNextFireTime(Date nextFireTime)
Sets the next time at which the
CronTriggerwill fire. This method should not be invoked by client code.
-
setPreviousFireTime
public void setPreviousFireTime(Date previousFireTime)
Set the previous time at which the
CronTriggerfired.This method should not be invoked by client code.
-
getTimeZone
public TimeZone getTimeZone()
Returns the time zone for which the
cronExpressionof thisCronTriggerwill be resolved.
-
setTimeZone
public void setTimeZone(TimeZone timeZone)
Sets the time zone for which the
cronExpressionof thisCronTriggerwill be resolved.If
setCronExpression(CronExpression)is called after this method, the TimeZon setting on the CronExpression will "win". However ifsetCronExpression(String)is called after this method, the time zone applied by this method will remain in effect, since the String cron expression does not carry a time zone!
-
setCronExpression
public void setCronExpression(String cronExpression)
-
setCronExpression
public void setCronExpression(CronExpression cronExpression)
-
getCronEx
public CronExpression getCronEx()
-
setCronEx
public void setCronEx(CronExpression cronEx)
-
getRepeatLimit
public int getRepeatLimit()
-
setRepeatLimit
public void setRepeatLimit(int repeatLimit)
-
getRepeatCount
public int getRepeatCount()
-
setRepeatCount
public void setRepeatCount(int repeatCount)
-
getCalendarNames
public String[] getCalendarNames()
-
setCalendarNames
public void setCalendarNames(String[] calendarNames)
-
getCalendars
public org.kie.api.runtime.Calendars getCalendars()
-
setCalendars
public void setCalendars(org.kie.api.runtime.Calendars calendars)
-
determineCronExpression
public static CronExpression determineCronExpression(String cronExpression)
-
hasNextFireTime
public Date hasNextFireTime()
Description copied from interface:TriggerThis method is used to query the trigger about the existence of a possible next fire time, but WITHOUT changing any internal state of the trigger. In other words, this method MUST not have side effects. As an analogy, if a trigger was a stack, this method would be the equivalent of a "peek()" call.- Specified by:
hasNextFireTimein interfaceTrigger- Returns:
- the Date of the next fire time or null if there is no next fire time.
-
nextFireTime
public Date nextFireTime()
Description copied from interface:TriggerThis method returns the date of the next fire time and updates the internal state of the Trigger to the following fire time if one exists. As an analogy, if a trigger was a stack, this method would be the equivalent of a "pop()" call.- Specified by:
nextFireTimein interfaceTrigger- Returns:
- the Date of the next fire time or null if there is no next fire time.
-
setFirstFireTimeAfter
public void setFirstFireTimeAfter()
Returns the next time at which the
CronTriggerwill fire, after the given time. If the trigger will not fire after the given time,nullwill be returned.Note that the date returned is NOT validated against the related org.quartz.Calendar (if any)
-
updateToNextIncludeDate
public void updateToNextIncludeDate()
-
-