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 Summary
Constructors Constructor Description DynamicPeriodicTrigger(long period)
Create a trigger with the given period in milliseconds.DynamicPeriodicTrigger(Duration duration)
Create a trigger with the provided duration. -
Method Summary
Modifier and Type Method Description boolean
equals(Object obj)
Duration
getDuration()
Return the duration.Duration
getInitialDuration()
Get the initial duration.int
hashCode()
boolean
isFixedRate()
Return whether this trigger is fixed rate.Date
nextExecutionTime(TriggerContext triggerContext)
Return the time after which a task should run again.void
setDuration(Duration duration)
Set the duration.void
setFixedRate(boolean fixedRate)
Specify whether the periodic interval should be measured between the scheduled start times rather than between actual completion times.void
setInitialDuration(Duration initialDuration)
Specify the delay for the initial execution.
-
Constructor Details
-
DynamicPeriodicTrigger
public DynamicPeriodicTrigger(long period)Create a trigger with the given period in milliseconds.- Parameters:
period
- Must not be negative
-
DynamicPeriodicTrigger
Create a trigger with the provided duration.- Parameters:
duration
- the duration.- Since:
- 5.1
-
-
Method Details
-
setInitialDuration
Specify the delay for the initial execution.- Parameters:
initialDuration
- the initial delay.- Since:
- 5.1
-
getDuration
Return the duration.- Returns:
- the duration.
- Since:
- 5.1
-
setDuration
Set the duration.- Parameters:
duration
- the duration.- Since:
- 5.1
-
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 rateboolean
flag.
-
isFixedRate
public boolean isFixedRate()Return whether this trigger is fixed rate.- Returns:
- the fixed rate.
-
nextExecutionTime
Return the time after which a task should run again.- Specified by:
nextExecutionTime
in interfaceTrigger
- Parameters:
triggerContext
- the trigger context to determine the previous state of schedule.- Returns:
- the the next schedule date.
-
hashCode
public int hashCode() -
equals
-