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 |
invokeBeanMethod(TimerImpl timer) |
protected void |
postTimeoutProcessing(TimerImpl timer)
After running the timer calculate the new state or expire the timer and persist it if changed.
|
protected void |
retryTimeout(TimerImpl timer)
After a timeout failed the timer need to retried.
|
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 invokeBeanMethod(TimerImpl timer) throws Exception
Exceptionprotected void retryTimeout(TimerImpl timer) throws Exception
timer - timer to retry and state updatesExceptionprotected void postTimeoutProcessing(TimerImpl timer) throws InterruptedException
timer - timer to post processing and persistInterruptedExceptionpublic void cancel()
Copyright © 2022 JBoss by Red Hat. All rights reserved.