Class DynamicPeriodicTrigger

java.lang.Object
org.springframework.integration.util.DynamicPeriodicTrigger
All Implemented Interfaces:
Trigger

public class DynamicPeriodicTrigger
extends Object
implements Trigger
This is a dynamically changeable Trigger. It is based on the PeriodicTrigger implementations. However, the fields of this dynamic trigger are not final and the properties can be inspected and set via explicit getters and setters. Changes to the trigger take effect after the next execution.
Since:
4.2
Author:
Gunnar Hillert, Gary Russell, Artem Bilan
  • Constructor Details

    • DynamicPeriodicTrigger

      public DynamicPeriodicTrigger​(long period)
      Create a trigger with the given period in milliseconds.
      Parameters:
      period - Must not be negative
    • DynamicPeriodicTrigger

      public DynamicPeriodicTrigger​(Duration duration)
      Create a trigger with the provided duration.
      Parameters:
      duration - the duration.
      Since:
      5.1
  • Method Details

    • setInitialDuration

      public void setInitialDuration​(Duration initialDuration)
      Specify the delay for the initial execution.
      Parameters:
      initialDuration - the initial delay.
      Since:
      5.1
    • getDuration

      public Duration getDuration()
      Return the duration.
      Returns:
      the duration.
      Since:
      5.1
    • setDuration

      public void setDuration​(Duration duration)
      Set the duration.
      Parameters:
      duration - the duration.
      Since:
      5.1
    • getInitialDuration

      public Duration getInitialDuration()
      Get the initial duration.
      Returns:
      the initial duration.
      Since:
      5.1
    • setFixedRate

      public void setFixedRate​(boolean fixedRate)
      Specify whether the periodic interval should be measured between the scheduled start times rather than between actual completion times. The latter, "fixed delay" behavior, is the default.
      Parameters:
      fixedRate - the fixed rate boolean flag.
    • isFixedRate

      public boolean isFixedRate()
      Return whether this trigger is fixed rate.
      Returns:
      the fixed rate.
    • nextExecutionTime

      public Date nextExecutionTime​(TriggerContext triggerContext)
      Return the time after which a task should run again.
      Specified by:
      nextExecutionTime in interface Trigger
      Parameters:
      triggerContext - the trigger context to determine the previous state of schedule.
      Returns:
      the the next schedule date.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object obj)
      Overrides:
      equals in class Object