Class CronTrigger

    • 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 CronTrigger should 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 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.

      • getPreviousFireTime

        public Date getPreviousFireTime()

        Returns the previous time at which the CronTrigger fired. If the trigger has not yet fired, null will be returned.

      • setNextFireTime

        public void setNextFireTime​(Date nextFireTime)

        Sets the next time at which the CronTrigger will fire. This method should not be invoked by client code.

      • setPreviousFireTime

        public void setPreviousFireTime​(Date previousFireTime)

        Set the previous time at which the CronTrigger fired.

        This method should not be invoked by client code.

      • getTimeZone

        public TimeZone getTimeZone()

        Returns the time zone for which the cronExpression of this CronTrigger will be resolved.

      • setTimeZone

        public void setTimeZone​(TimeZone timeZone)

        Sets the time zone for which the cronExpression of this CronTrigger will be resolved.

        If setCronExpression(CronExpression) is called after this method, the TimeZon setting on the CronExpression will "win". However if setCronExpression(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)
      • 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: Trigger
        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. 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:
        hasNextFireTime in interface Trigger
        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: Trigger
        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. As an analogy, if a trigger was a stack, this method would be the equivalent of a "pop()" call.
        Specified by:
        nextFireTime in interface Trigger
        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 CronTrigger will fire, after the given time. If the trigger will not fire after the given time, null will be returned.

        Note that the date returned is NOT validated against the related org.quartz.Calendar (if any)

      • getTimeAfter

        protected Date getTimeAfter​(Date afterTime)
      • updateToNextIncludeDate

        public void updateToNextIncludeDate()