|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Created by the TimerService
for servlet applications
wishing to schedule future tasks.
TimerService
,
TimerListener
Method Summary | |
void |
cancel()
Cancels this timer. |
SipApplicationSession |
getApplicationSession()
Returns the application session associated with this ServletTimer . |
java.io.Serializable |
getInfo()
Get the information associated with the timer at the time of creation. |
long |
scheduledExecutionTime()
Returns the scheduled expiration time of the most recent actual expiration of this timer. |
Method Detail |
public SipApplicationSession getApplicationSession()
ServletTimer
.ServletTimer
public java.io.Serializable getInfo()
Serializable
object that was passed in
at timer creation, or null
if the info argument
passed in at timer creation was null
.public long scheduledExecutionTime()
This method is typically invoked from within
TimerListener.timerFired
to determine whether the
timer callback was sufficiently timely to warrant performing the
scheduled activity:
public void run() { if (System.currentTimeMillis() - scheduledExecutionTime() >= MAX_TARDINESS) return; // Too late; skip this execution. // Perform the task }
This method is typically not used in conjunction with fixed-delay execution repeating tasks, as their scheduled execution times are allowed to drift over time, and so are not terribly significant.
Date.getTime()
.
The return value is undefined if the timer has yet to expire for
the first time.public void cancel()
Note that calling this method on a repeating ServletTimer
from within the timerFired
method of a
TimerListener
absolutely guarantees that the timer
will not fire again (unless rescheduled).
This method may be called repeatedly; the second and subsequent calls have no effect.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |