Class SimpleTriggerImpl

    • Constructor Detail

      • SimpleTriggerImpl

        public SimpleTriggerImpl()

        Create a SimpleTrigger with no settings.

      • SimpleTriggerImpl

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

        Create a SimpleTrigger that will occur immediately, and not repeat.

      • SimpleTriggerImpl

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

        Create a SimpleTrigger that will occur immediately, and not repeat.

      • SimpleTriggerImpl

        @Deprecated
        public SimpleTriggerImpl​(java.lang.String name,
                                 int repeatCount,
                                 long repeatInterval)
        Deprecated.
        use a TriggerBuilder instead

        Create a SimpleTrigger that will occur immediately, and repeat at the given interval the given number of times.

      • SimpleTriggerImpl

        @Deprecated
        public SimpleTriggerImpl​(java.lang.String name,
                                 java.lang.String group,
                                 int repeatCount,
                                 long repeatInterval)
        Deprecated.
        use a TriggerBuilder instead

        Create a SimpleTrigger that will occur immediately, and repeat at the given interval the given number of times.

      • SimpleTriggerImpl

        @Deprecated
        public SimpleTriggerImpl​(java.lang.String name,
                                 java.util.Date startTime)
        Deprecated.
        use a TriggerBuilder instead

        Create a SimpleTrigger that will occur at the given time, and not repeat.

      • SimpleTriggerImpl

        @Deprecated
        public SimpleTriggerImpl​(java.lang.String name,
                                 java.lang.String group,
                                 java.util.Date startTime)
        Deprecated.
        use a TriggerBuilder instead

        Create a SimpleTrigger that will occur at the given time, and not repeat.

      • SimpleTriggerImpl

        @Deprecated
        public SimpleTriggerImpl​(java.lang.String name,
                                 java.util.Date startTime,
                                 java.util.Date endTime,
                                 int repeatCount,
                                 long repeatInterval)
        Deprecated.
        use a TriggerBuilder instead

        Create a SimpleTrigger that will occur at the given time, and repeat at the given interval the given number of times, or until the given end time.

        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.
        repeatCount - The number of times for the Trigger to repeat firing, use SimpleTrigger.REPEAT_INDEFINITELY for unlimited times.
        repeatInterval - The number of milliseconds to pause between the repeat firing.
      • SimpleTriggerImpl

        @Deprecated
        public SimpleTriggerImpl​(java.lang.String name,
                                 java.lang.String group,
                                 java.util.Date startTime,
                                 java.util.Date endTime,
                                 int repeatCount,
                                 long repeatInterval)
        Deprecated.
        use a TriggerBuilder instead

        Create a SimpleTrigger that will occur at the given time, and repeat at the given interval the given number of times, or until the given end time.

        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.
        repeatCount - The number of times for the Trigger to repeat firing, use SimpleTrigger.REPEAT_INDEFINITELY for unlimited times.
        repeatInterval - The number of milliseconds to pause between the repeat firing.
      • SimpleTriggerImpl

        @Deprecated
        public SimpleTriggerImpl​(java.lang.String name,
                                 java.lang.String group,
                                 java.lang.String jobName,
                                 java.lang.String jobGroup,
                                 java.util.Date startTime,
                                 java.util.Date endTime,
                                 int repeatCount,
                                 long repeatInterval)
        Deprecated.
        use a TriggerBuilder instead

        Create a SimpleTrigger that will occur at the given time, fire the identified Job and repeat at the given interval the given number of times, or until the given end time.

        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.
        repeatCount - The number of times for the Trigger to repeat firing, use SimpleTrigger.REPEAT_INDEFINITELYfor unlimited times.
        repeatInterval - The number of milliseconds to pause between the repeat firing.
    • Method Detail

      • getStartTime

        public java.util.Date getStartTime()

        Get the time at which the SimpleTrigger should occur.

        Specified by:
        getStartTime in interface Trigger
      • setStartTime

        public void setStartTime​(java.util.Date startTime)

        Set the time at which the SimpleTrigger should occur.

        Specified by:
        setStartTime in interface MutableTrigger
        Throws:
        java.lang.IllegalArgumentException - if startTime is null.
      • getEndTime

        public java.util.Date getEndTime()

        Get the time at which the SimpleTrigger should quit repeating - even if repeatCount isn't yet satisfied.

        Specified by:
        getEndTime in interface Trigger
        See Also:
        getFinalFireTime()
      • getRepeatCount

        public int getRepeatCount()
        Description copied from interface: SimpleTrigger
        Get the number of times the SimpleTrigger should repeat, after the initial firing, after which it will be automatically deleted. The total number of firings will be this number + 1.
        Specified by:
        getRepeatCount in interface SimpleTrigger
        Returns:
        the number of times the trigger should repeat after the initial firing.
        See Also:
        SimpleTrigger.REPEAT_INDEFINITELY
      • setRepeatCount

        public void setRepeatCount​(int repeatCount)

        Set the number of time the SimpleTrigger should repeat, after which it will be automatically deleted.

        Throws:
        java.lang.IllegalArgumentException - if repeatCount is < 0
        See Also:
        SimpleTrigger.REPEAT_INDEFINITELY
      • getRepeatInterval

        public long getRepeatInterval()
        Description copied from interface: SimpleTrigger

        Get the time interval (in milliseconds) at which the SimpleTrigger should repeat.

        Specified by:
        getRepeatInterval in interface SimpleTrigger
      • setRepeatInterval

        public void setRepeatInterval​(long repeatInterval)

        Set the time interval (in milliseconds) at which the SimpleTrigger should repeat.

        Throws:
        java.lang.IllegalArgumentException - if repeatInterval is < 0
      • getTimesTriggered

        public int getTimesTriggered()

        Get the number of times the SimpleTrigger has already fired.

        Specified by:
        getTimesTriggered in interface SimpleTrigger
      • setTimesTriggered

        public void setTimesTriggered​(int timesTriggered)

        Set the number of times the SimpleTrigger has already fired.

      • updateAfterMisfire

        public void updateAfterMisfire​(Calendar cal)

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

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

        • If the Repeat Count is 0, then the instruction will be interpreted as MISFIRE_INSTRUCTION_FIRE_NOW.
        • If the Repeat Count is REPEAT_INDEFINITELY, then the instruction will be interpreted as MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT. WARNING: using MISFIRE_INSTRUCTION_RESCHEDULE_NEXT_WITH_REMAINING_COUNT with a trigger that has a non-null end-time may cause the trigger to never fire again if the end-time arrived during the misfire time span.
        • If the Repeat Count is > 0, then the instruction will be interpreted as MISFIRE_INSTRUCTION_RESCHEDULE_NOW_WITH_EXISTING_REPEAT_COUNT.
        Specified by:
        updateAfterMisfire in interface OperableTrigger
      • 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
        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).
      • getNextFireTime

        public java.util.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.

        Specified by:
        getNextFireTime in interface Trigger
        See Also:
        TriggerUtils.computeFireTimesBetween(org.quartz.spi.OperableTrigger, org.quartz.Calendar, java.util.Date, java.util.Date)
      • getPreviousFireTime

        public java.util.Date getPreviousFireTime()

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

        Specified by:
        getPreviousFireTime in interface Trigger
      • setNextFireTime

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

        Set the next time at which the SimpleTrigger should 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 SimpleTrigger fired.

        This method should not be invoked by client code.

        Specified by:
        setPreviousFireTime in interface OperableTrigger
      • getFireTimeAfter

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

        Returns the next time at which the SimpleTrigger will fire, after the given time. If the trigger will not fire after the given time, null will be returned.

        Specified by:
        getFireTimeAfter in interface Trigger
      • getFireTimeBefore

        public java.util.Date getFireTimeBefore​(java.util.Date end)

        Returns the last time at which the SimpleTrigger will fire, before the given time. If the trigger will not fire before the given time, null will be returned.

      • computeNumTimesFiredBetween

        public int computeNumTimesFiredBetween​(java.util.Date start,
                                               java.util.Date end)
      • getFinalFireTime

        public java.util.Date getFinalFireTime()

        Returns the final time at which the SimpleTrigger will fire, if repeatCount is REPEAT_INDEFINITELY, null will be returned.

        Note that the return time may be in the past.

        Specified by:
        getFinalFireTime in interface Trigger
      • mayFireAgain

        public boolean mayFireAgain()

        Determines whether or not the SimpleTrigger will occur again.

        Specified by:
        mayFireAgain in interface Trigger
      • hasAdditionalProperties

        public boolean hasAdditionalProperties()
        Used by extensions of SimpleTrigger 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 SimpleTrigger table.
        Specified by:
        hasAdditionalProperties in interface CoreTrigger