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.Scheduled.fixedRate()
,
Scheduled.fixedDelay()
,
ScheduledTaskRegistrar.setFixedRateTasksList(java.util.List)
,
ScheduledTaskRegistrar.setFixedDelayTasksList(java.util.List)
,
TaskScheduler
Constructor and Description |
---|
IntervalTask(Runnable runnable,
long interval)
Create a new
IntervalTask with no initial delay. |
IntervalTask(Runnable runnable,
long interval,
long initialDelay)
Create a new
IntervalTask . |
Modifier and Type | Method and Description |
---|---|
long |
getInitialDelay() |
long |
getInterval() |
getRunnable
public IntervalTask(Runnable runnable, long interval, long initialDelay)
IntervalTask
.runnable
- the underlying task to executeinterval
- how often in milliseconds the task should be executedinitialDelay
- initial delay before first execution of the taskpublic IntervalTask(Runnable runnable, long interval)
IntervalTask
with no initial delay.runnable
- the underlying task to executeinterval
- how often in milliseconds the task should be executed