org.springframework.scheduling.config
Class IntervalTask
java.lang.Object
org.springframework.scheduling.config.Task
org.springframework.scheduling.config.IntervalTask
public class IntervalTask
- extends Task
Task
implementation defining a Runnable
to be executed at a given
millisecond interval which may be treated as fixed-rate or fixed-delay depending on
context.
- Since:
- 3.2
- Author:
- Chris Beams
- See Also:
Scheduled.fixedRate()
,
Scheduled.fixedDelay()
,
ScheduledTaskRegistrar.setFixedRateTasksList(java.util.List)
,
ScheduledTaskRegistrar.setFixedDelayTasksList(java.util.List)
,
TaskScheduler
Constructor Summary |
IntervalTask(java.lang.Runnable runnable,
long interval)
Create a new IntervalTask with no initial delay. |
IntervalTask(java.lang.Runnable runnable,
long interval,
long initialDelay)
Create a new IntervalTask . |
Methods inherited from class org.springframework.scheduling.config.Task |
getRunnable |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
IntervalTask
public IntervalTask(java.lang.Runnable runnable,
long interval,
long initialDelay)
- Create a new
IntervalTask
.
- Parameters:
runnable
- the underlying task to executeinterval
- how often in milliseconds the task should be executedinitialDelay
- initial delay before first execution of the task
IntervalTask
public IntervalTask(java.lang.Runnable runnable,
long interval)
- Create a new
IntervalTask
with no initial delay.
- Parameters:
runnable
- the underlying task to executeinterval
- how often in milliseconds the task should be executed
getInterval
public long getInterval()
getInitialDelay
public long getInitialDelay()