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 String |
timedObjectId |
protected String |
timerId |
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(TimerImpl timer) |
protected void |
callTimeout(TimerImpl timer) |
void |
cancel() |
protected void |
postTimeoutProcessing(TimerImpl timer) |
protected void |
retryTimeout(TimerImpl timer) |
void |
run()
Invokes the timeout method through the
TimedObjectInvoker corresponding
to the TimerImpl to which this TimerTask belongs. |
protected void |
scheduleTimeoutIfRequired(TimerImpl timer) |
protected final String timedObjectId
protected final String timerId
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(TimerImpl timer)
protected void postTimeoutProcessing(TimerImpl timer)
public void cancel()
Copyright © 2014 JBoss by Red Hat. All rights reserved.