public class DynamicPeriodicTrigger
extends java.lang.Object
implements org.springframework.scheduling.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.Constructor and Description |
---|
DynamicPeriodicTrigger(long period)
Create a trigger with the given period in milliseconds.
|
DynamicPeriodicTrigger(long period,
java.util.concurrent.TimeUnit timeUnit)
Create a trigger with the given period and time unit.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
long |
getInitialDelay() |
long |
getPeriod() |
java.util.concurrent.TimeUnit |
getTimeUnit() |
int |
hashCode() |
boolean |
isFixedRate() |
java.util.Date |
nextExecutionTime(org.springframework.scheduling.TriggerContext triggerContext)
Return the time after which a task should run again.
|
void |
setFixedRate(boolean fixedRate)
Specify whether the periodic interval should be measured between the
scheduled start times rather than between actual completion times.
|
void |
setInitialDelay(long initialDelay)
Specify the delay for the initial execution.
|
void |
setPeriod(long period)
Specify the period of the trigger.
|
void |
setTimeUnit(java.util.concurrent.TimeUnit timeUnit) |
public DynamicPeriodicTrigger(long period)
TimeUnit
will be initialized to TimeUnit.MILLISECONDS.period
- Must not be negativepublic DynamicPeriodicTrigger(long period, java.util.concurrent.TimeUnit timeUnit)
setInitialDelay(long)
.period
- Must not be negativetimeUnit
- Must not be nullpublic void setInitialDelay(long initialDelay)
TimeUnit
. If no time unit was explicitly
provided upon instantiation, the default is milliseconds.initialDelay
- the initial delay in milliseconds.public void setFixedRate(boolean fixedRate)
fixedRate
- the fixed rate boolean
flag.public java.util.Date nextExecutionTime(org.springframework.scheduling.TriggerContext triggerContext)
nextExecutionTime
in interface org.springframework.scheduling.Trigger
triggerContext
- the trigger context to determine the previous state of schedule.public long getPeriod()
public void setPeriod(long period)
TimeUnit
. If no time unit was explicitly
provided upon instantiation, the default is milliseconds.period
- Must not be negativepublic java.util.concurrent.TimeUnit getTimeUnit()
public void setTimeUnit(java.util.concurrent.TimeUnit timeUnit)
public long getInitialDelay()
public boolean isFixedRate()
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object