UM Java API
6.16.1
|
Public Member Functions | |
LBMTimer (LBMContext lbmctx, long milliseconds) throws LBMException | |
LBMTimer (LBMContext lbmctx, long milliseconds, LBMEventQueue lbmevq) throws LBMException | |
LBMTimer (LBMContext lbmctx, long milliseconds, LBMTimerCallback cb, Object cbArg) throws LBMException | |
LBMTimer (LBMContext lbmctx, long milliseconds, LBMTimerCallback cb, Object cbArg, LBMEventQueue lbmevq) throws LBMException | |
void | addTimerCallback (LBMTimerCallback cb) |
void | addTimerCallback (LBMTimerCallback cb, Object cbArg) |
void | removeTimerCallback (LBMTimerCallback cb) |
void | removeTimerCallback (LBMTimerCallback cb, Object cbArg) |
void | cancel () throws LBMException |
void | cancel (boolean rescheduling) throws LBMException |
void | reschedule (long milliseconds) throws LBMException |
LBMContext | context () |
LBM Timer class. This class can be subclassed in order to override the default onExpiration() method used to handle expiration of the timer or a constructor can be used to specify an LBMTimerCallback interface for handling the timer expiration callback.
com.latencybusters.lbm.LBMTimer.LBMTimer | ( | LBMContext | lbmctx, |
long | milliseconds | ||
) | throws LBMException |
Creates a timer associated with a specific context that expires with a specified delay.
A zero duration timer is legal and causes the associated callback to be called as soon as possible on the context thread.
The timer object will not be collected by GC until the timer has expired or cancel() has been called, even if it goes out of scope.
lbmctx | LBMContext object with which to associate this timer (determines which LBM thread will execute the timer function). |
milliseconds | Number of milliseconds until the timer expires |
LBMException | if any timer scheduling error occurs. |
com.latencybusters.lbm.LBMTimer.LBMTimer | ( | LBMContext | lbmctx, |
long | milliseconds, | ||
LBMEventQueue | lbmevq | ||
) | throws LBMException |
Creates a timer associated with a specific context and event queue that expires with a specified delay.
A zero duration timer is legal and causes the associated callback to be called as soon as possible on the context thread or to be enqueued as an event on the associated event queue. In this case, the event queue dispatching thread calls the associated callback after all currently pending events have been dispatched.
The timer object will not be collected by GC until the timer has expired or cancel() has been called, even if it goes out of scope.
lbmctx | LBMContext object with which to associate this timer |
milliseconds | Number of milliseconds until the timer expires |
lbmevq | Event queue with which to associate this timer (the timer events will be posted to this event queue) |
LBMException | if any timer scheduling error occurs. |
com.latencybusters.lbm.LBMTimer.LBMTimer | ( | LBMContext | lbmctx, |
long | milliseconds, | ||
LBMTimerCallback | cb, | ||
Object | cbArg | ||
) | throws LBMException |
Creates a timer associated with a specific context that expires with a specified delay.
A zero duration timer is legal and causes the associated callback to be called as soon as possible on the context thread.
The timer object will not be collected by GC until the timer has expired or cancel() has been called, even if it goes out of scope.
lbmctx | LBMContext object with which to associate this timer (determines which LBM thread will execute the timer function). |
milliseconds | Number of milliseconds until the timer expires |
cb | An object implementing the LBMTimerCallback interface |
cbArg | Callback object passed as token to callback interface |
LBMException | if any timer scheduling error occurs. |
References com.latencybusters.lbm.LBMTimer.addTimerCallback().
com.latencybusters.lbm.LBMTimer.LBMTimer | ( | LBMContext | lbmctx, |
long | milliseconds, | ||
LBMTimerCallback | cb, | ||
Object | cbArg, | ||
LBMEventQueue | lbmevq | ||
) | throws LBMException |
Creates a timer associated with a specific context and event queue that expires with a specified delay.
A zero duration timer is legal and causes the associated callback to be called as soon as possible on the context thread or to be enqueued as an event on the associated event queue. In this case, the event queue dispatching thread calls the associated callback after all currently pending events have been dispatched.
The timer object will not be collected by GC until the timer has expired or cancel() has been called, even if it goes out of scope.
lbmctx | LBMContext object with which to associate this timer |
milliseconds | Number of milliseconds until the timer expires |
lbmevq | Event queue with which to associate this timer |
cb | An object implementing the LBMTimerCallback interface |
cbArg | Callback object passed as token to callback interface (the timer events will be posted to this event queue) |
LBMException | if any timer scheduling error occurs. |
References com.latencybusters.lbm.LBMTimer.addTimerCallback().
void com.latencybusters.lbm.LBMTimer.addTimerCallback | ( | LBMTimerCallback | cb | ) |
Register a timer callback
cb | Object implementing the LBMTimerCallback interface |
Referenced by com.latencybusters.lbm.LBMTimer.LBMTimer(), and com.latencybusters.lbm.LBMContext.scheduleTimer().
void com.latencybusters.lbm.LBMTimer.addTimerCallback | ( | LBMTimerCallback | cb, |
Object | cbArg | ||
) |
Register a timer callback (and callback token)
cb | Object implementing the LBMTimerCallback interface |
cbArg | Callback token object |
void com.latencybusters.lbm.LBMTimer.cancel | ( | ) | throws LBMException |
Cancel timer
LBMException | if the timer was invalid or could not be cancelled. |
Referenced by com.latencybusters.lbm.LBMTimer.reschedule().
void com.latencybusters.lbm.LBMTimer.cancel | ( | boolean | rescheduling | ) | throws LBMException |
Cancel timer
rescheduling | External users should always pass in false. Unexpected behavior may result if true is passed in. |
LBMException | if the timer was invalid or could not be cancelled. |
LBMContext com.latencybusters.lbm.LBMTimer.context | ( | ) |
Get the LBMContext object associated with this timer.
void com.latencybusters.lbm.LBMTimer.removeTimerCallback | ( | LBMTimerCallback | cb | ) |
Deregister a timer callback
cb | Previously registered object implementing the LBMTimerCallback interface |
void com.latencybusters.lbm.LBMTimer.removeTimerCallback | ( | LBMTimerCallback | cb, |
Object | cbArg | ||
) |
Deregister a timer callback (and callback token)
cb | Previously registered object implementing the LBMTimerCallback interface |
cbArg | Callback token for previously registered object |
void com.latencybusters.lbm.LBMTimer.reschedule | ( | long | milliseconds | ) | throws LBMException |
Reschedule this timer to expire in a specified number of milliseconds.
milliseconds | Number of milliseconds until this timer should expire. |
LBMException | if any timer scheduling error occurs. |
References com.latencybusters.lbm.LBMTimer.cancel(), and com.latencybusters.lbm.LBMTimerCallback.onExpiration().
Referenced by com.latencybusters.lbm.LBMContext.scheduleTimer().