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.Constructor and Description |
---|
DynamicPeriodicTrigger(long period)
Create a trigger with the given period in milliseconds.
|
DynamicPeriodicTrigger(long period,
TimeUnit timeUnit)
Create a trigger with the given period and time unit.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
long |
getInitialDelay() |
long |
getPeriod() |
TimeUnit |
getTimeUnit() |
int |
hashCode() |
boolean |
isFixedRate() |
Date |
nextExecutionTime(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(TimeUnit timeUnit) |
public DynamicPeriodicTrigger(long period)
TimeUnit
will be initialized to TimeUnit.MILLISECONDS.period
- Must not be negativepublic DynamicPeriodicTrigger(long period, 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 Date nextExecutionTime(TriggerContext triggerContext)
nextExecutionTime
in interface 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 TimeUnit getTimeUnit()
public void setTimeUnit(TimeUnit timeUnit)
public long getInitialDelay()
public boolean isFixedRate()