|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.scheduling.support.PeriodicTrigger
public class PeriodicTrigger
A trigger for periodic task execution. The period may be applied as either
fixed-rate or fixed-delay, and an initial delay value may also be configured.
The default initial delay is 0, and the default behavior is fixed-delay
(i.e. the interval between successive executions is measured from each
true
.
Note that the TaskScheduler interface already defines methods for scheduling tasks at fixed-rate or with fixed-delay. Both also support an optional value for the initial delay. Those methods should be used directly whenever possible. The value of this Trigger implementation is that it can be used within components that rely on the Trigger abstraction. For example, it may be convenient to allow periodic triggers, cron-based triggers, and even custom Trigger implementations to be used interchangeably.
Constructor Summary | |
---|---|
PeriodicTrigger(long period)
Create a trigger with the given period in milliseconds. |
|
PeriodicTrigger(long period,
TimeUnit timeUnit)
Create a trigger with the given period and time unit. |
Method Summary | |
---|---|
boolean |
equals(Object obj)
|
int |
hashCode()
|
Date |
nextExecutionTime(TriggerContext triggerContext)
Returns 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. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PeriodicTrigger(long period)
public PeriodicTrigger(long period, TimeUnit timeUnit)
setInitialDelay(long)
.
Method Detail |
---|
public void setInitialDelay(long initialDelay)
TimeUnit
. If no time unit was explicitly
provided upon instantiation, the default is milliseconds.
public void setFixedRate(boolean fixedRate)
public Date nextExecutionTime(TriggerContext triggerContext)
nextExecutionTime
in interface Trigger
triggerContext
- context object encapsulating last execution times
and last completion time
null
if the trigger won't fire anymorepublic boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |