Class CronTriggerImpl

    • Field Detail

      • YEAR_TO_GIVEUP_SCHEDULING_AT

        protected static final int YEAR_TO_GIVEUP_SCHEDULING_AT
    • Constructor Detail

      • CronTriggerImpl

        public CronTriggerImpl()

        Create a CronTrigger with no settings.

        The start-time will also be set to the current time, and the time zone will be set the the system's default time zone.

      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name)
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger with the given name and default group.

        The start-time will also be set to the current time, and the time zone will be set the the system's default time zone.

      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name,
                               java.lang.String group)
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger with the given name and group.

        The start-time will also be set to the current time, and the time zone will be set the the system's default time zone.

      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name,
                               java.lang.String group,
                               java.lang.String cronExpression)
                        throws java.text.ParseException
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger with the given name, group and expression.

        The start-time will also be set to the current time, and the time zone will be set the the system's default time zone.

        Throws:
        java.text.ParseException
      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name,
                               java.lang.String group,
                               java.lang.String jobName,
                               java.lang.String jobGroup)
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger with the given name and group, and associated with the identified JobDetail.

        The start-time will also be set to the current time, and the time zone will be set the the system's default time zone.

      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name,
                               java.lang.String group,
                               java.lang.String jobName,
                               java.lang.String jobGroup,
                               java.lang.String cronExpression)
                        throws java.text.ParseException
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger with the given name and group, associated with the identified JobDetail, and with the given "cron" expression.

        The start-time will also be set to the current time, and the time zone will be set the the system's default time zone.

        Throws:
        java.text.ParseException
      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name,
                               java.lang.String group,
                               java.lang.String jobName,
                               java.lang.String jobGroup,
                               java.lang.String cronExpression,
                               java.util.TimeZone timeZone)
                        throws java.text.ParseException
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger with the given name and group, associated with the identified JobDetail, and with the given "cron" expression resolved with respect to the TimeZone.

        Throws:
        java.text.ParseException
      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name,
                               java.lang.String group,
                               java.lang.String jobName,
                               java.lang.String jobGroup,
                               java.util.Date startTime,
                               java.util.Date endTime,
                               java.lang.String cronExpression)
                        throws java.text.ParseException
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger that will occur at the given time, until the given end time.

        If null, the start-time will also be set to the current time, the time zone will be set the the system's default.

        Parameters:
        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.
        Throws:
        java.text.ParseException
      • CronTriggerImpl

        @Deprecated
        public CronTriggerImpl​(java.lang.String name,
                               java.lang.String group,
                               java.lang.String jobName,
                               java.lang.String jobGroup,
                               java.util.Date startTime,
                               java.util.Date endTime,
                               java.lang.String cronExpression,
                               java.util.TimeZone timeZone)
                        throws java.text.ParseException
        Deprecated.
        use a TriggerBuilder instead

        Create a CronTrigger with fire time dictated by the cronExpression resolved with respect to the specified timeZone occurring from the startTime until the given endTime.

        If null, the start-time will also be set to the current time. If null, the time zone will be set to the system's default.

        Parameters:
        name - of the Trigger
        group - of the Trigger
        jobName - name of the JobDetail executed on firetime
        jobGroup - group of the JobDetail executed on firetime
        startTime - A Date set to the earliest time for the Trigger to start firing.
        endTime - A Date set to the time for the Trigger to quit repeat firing.
        cronExpression - A cron expression dictating the firing sequence of the Trigger
        timeZone - Specifies for which time zone the cronExpression should be interpreted, i.e. the expression 0 0 10 * * ?, is resolved to 10:00 am in this time zone.
        Throws:
        java.text.ParseException - if the cronExpression is invalid.
    • Method Detail

      • setCronExpression

        public void setCronExpression​(java.lang.String cronExpression)
                               throws java.text.ParseException
        Throws:
        java.text.ParseException
      • setCronExpression

        public void setCronExpression​(CronExpression cronExpression)
        Set the CronExpression to the given one. The TimeZone on the passed-in CronExpression over-rides any that was already set on the Trigger.
      • setStartTime

        public void setStartTime​(java.util.Date startTime)
        Description copied from class: AbstractTrigger

        The time at which the trigger's scheduling should start. May or may not be the first actual fire time of the trigger, depending upon the type of trigger and the settings of the other properties of the trigger. However the first actual first time will not be before this date.

        Setting a value in the past may cause a new trigger to compute a first fire time that is in the past, which may cause an immediate misfire of the trigger.

        Specified by:
        setStartTime in interface MutableTrigger
        Specified by:
        setStartTime in class AbstractTrigger<CronTrigger>
      • setNextFireTime

        public void setNextFireTime​(java.util.Date nextFireTime)

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

        Specified by:
        setNextFireTime in interface OperableTrigger
      • setPreviousFireTime

        public void setPreviousFireTime​(java.util.Date previousFireTime)

        Set the previous time at which the CronTrigger fired.

        This method should not be invoked by client code.

        Specified by:
        setPreviousFireTime in interface OperableTrigger
      • getTimeZone

        public java.util.TimeZone getTimeZone()
        Description copied from interface: CronTrigger

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

        Specified by:
        getTimeZone in interface CronTrigger
      • setTimeZone

        public void setTimeZone​(java.util.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!

      • getFireTimeAfter

        public java.util.Date getFireTimeAfter​(java.util.Date afterTime)

        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)

        Specified by:
        getFireTimeAfter in interface Trigger
        Specified by:
        getFireTimeAfter in class AbstractTrigger<CronTrigger>
      • getFinalFireTime

        public java.util.Date getFinalFireTime()

        NOT YET IMPLEMENTED: Returns the final time at which the CronTrigger will fire.

        Note that the return time *may* be in the past. and the date returned is not validated against org.quartz.calendar

        Specified by:
        getFinalFireTime in interface Trigger
        Specified by:
        getFinalFireTime in class AbstractTrigger<CronTrigger>
      • updateAfterMisfire

        public void updateAfterMisfire​(Calendar cal)

        Updates the CronTrigger's state based on the MISFIRE_INSTRUCTION_XXX that was selected when the CronTrigger was created.

        If the misfire instruction is set to MISFIRE_INSTRUCTION_SMART_POLICY, then the following scheme will be used:

        • The instruction will be interpreted as MISFIRE_INSTRUCTION_FIRE_ONCE_NOW
        Specified by:
        updateAfterMisfire in interface OperableTrigger
        Specified by:
        updateAfterMisfire in class AbstractTrigger<CronTrigger>
      • willFireOn

        public boolean willFireOn​(java.util.Calendar test)

        Determines whether the date and (optionally) time of the given Calendar instance falls on a scheduled fire-time of this trigger.

        Equivalent to calling willFireOn(cal, false).

        Parameters:
        test - the date to compare
        See Also:
        willFireOn(Calendar, boolean)
      • willFireOn

        public boolean willFireOn​(java.util.Calendar test,
                                  boolean dayOnly)

        Determines whether the date and (optionally) time of the given Calendar instance falls on a scheduled fire-time of this trigger.

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

        Parameters:
        test - the date to compare
        dayOnly - if set to true, the method will only determine if the trigger will fire during the day represented by the given Calendar (hours, minutes and seconds will be ignored).
        See Also:
        willFireOn(Calendar)
      • computeFirstFireTime

        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.

        Specified by:
        computeFirstFireTime in interface OperableTrigger
        Specified by:
        computeFirstFireTime in class AbstractTrigger<CronTrigger>
        Returns:
        the first time at which the Trigger will be fired by the scheduler, which is also the same value getNextFireTime() will return (until after the first firing of the Trigger).
      • hasAdditionalProperties

        public boolean hasAdditionalProperties()
        Used by extensions of CronTrigger to imply that there are additional properties, specifically so that extensions can choose whether to be stored as a serialized blob, or as a flattened CronTrigger table.
        Specified by:
        hasAdditionalProperties in interface CoreTrigger
      • getTimeAfter

        protected java.util.Date getTimeAfter​(java.util.Date afterTime)
      • getTimeBefore

        protected java.util.Date getTimeBefore​(java.util.Date eTime)
        NOT YET IMPLEMENTED: Returns the time before the given time that this CronTrigger will fire.