public class TimerTask<T extends TimerImpl> extends Object implements Runnable
Timer
schedule.
A TimerTask
is responsible for invoking the timeout method on the target, through
the use of TimedObjectInvoker
For calendar timers, this TimerTask
is additionally responsible for creating and
scheduling the next round of timer task.
Modifier and Type | Field and Description |
---|---|
protected T |
timer
The timer to which this
TimerTask belongs |
protected TimerServiceImpl |
timerService
TimerServiceImpl to which this TimerTask belongs |
Constructor and Description |
---|
TimerTask(T timer)
Creates a
TimerTask for the timer |
Modifier and Type | Method and Description |
---|---|
protected Date |
calculateNextTimeout() |
protected void |
callTimeout() |
protected T |
getTimer() |
protected void |
postTimeoutProcessing() |
protected void |
retryTimeout() |
void |
run()
Invokes the timeout method through the
TimedObjectInvoker corresponding
to the TimerImpl to which this TimerTask belongs. |
protected void |
scheduleTimeoutIfRequired() |
protected final TimerServiceImpl timerService
TimerServiceImpl
to which this TimerTask
belongspublic TimerTask(T timer)
TimerTask
for the timertimer
- The timer for which this task is being created.IllegalArgumentException
- If the passed timer is nullpublic void run()
TimedObjectInvoker
corresponding
to the TimerImpl
to which this TimerTask
belongs.
This method also sets other attributes on the TimerImpl
including the
next timeout of the timer and the timer state.
Additionally, for calendar timers, this method even schedules the next timeout timer task before calling the timeout method for the current timeout.
protected void scheduleTimeoutIfRequired()
protected Date calculateNextTimeout()
protected T getTimer()
protected void postTimeoutProcessing()
Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.