public class DynamicPeriodicTrigger extends Object implements Trigger
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.Constructor and Description |
---|
DynamicPeriodicTrigger(java.time.Duration duration)
Create a trigger with the provided duration.
|
DynamicPeriodicTrigger(long period)
Create a trigger with the given period in milliseconds.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
java.time.Duration |
getDuration()
Return the duration.
|
java.time.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(java.time.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(java.time.Duration initialDuration)
Specify the delay for the initial execution.
|
public DynamicPeriodicTrigger(long period)
period
- Must not be negativepublic DynamicPeriodicTrigger(java.time.Duration duration)
duration
- the duration.public void setInitialDuration(java.time.Duration initialDuration)
initialDuration
- the initial delay.public java.time.Duration getDuration()
public void setDuration(java.time.Duration duration)
duration
- the duration.public java.time.Duration getInitialDuration()
public void setFixedRate(boolean fixedRate)
fixedRate
- the fixed rate boolean
flag.public boolean isFixedRate()
public Date nextExecutionTime(TriggerContext triggerContext)
nextExecutionTime
in interface Trigger
triggerContext
- the trigger context to determine the previous state of schedule.