|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.latencybusters.lbm.LBMTimer
public class LBMTimer
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.
Constructor Summary | |
---|---|
LBMTimer(LBMContext lbmctx,
long milliseconds)
Creates a timer associated with a specific context that expires with a specified delay. |
|
LBMTimer(LBMContext lbmctx,
long milliseconds,
LBMEventQueue lbmevq)
Creates a timer associated with a specific context and event queue that expires with a specified delay. |
|
LBMTimer(LBMContext lbmctx,
long milliseconds,
LBMTimerCallback cb,
java.lang.Object cbArg)
Creates a timer associated with a specific context that expires with a specified delay. |
|
LBMTimer(LBMContext lbmctx,
long milliseconds,
LBMTimerCallback cb,
java.lang.Object cbArg,
LBMEventQueue lbmevq)
Creates a timer associated with a specific context and event queue that expires with a specified delay. |
Method Summary | |
---|---|
void |
addTimerCallback(LBMTimerCallback cb)
Register a timer callback |
void |
addTimerCallback(LBMTimerCallback cb,
java.lang.Object cbArg)
Register a timer callback (and callback token) |
void |
cancel()
Cancel timer |
void |
cancel(boolean rescheduling)
Deprecated. This method is provided for backwards compatibility with LBM 3.3.7/UME 2.0.5; please use the cancel() method instead. |
LBMContext |
context()
Get the LBMContext object associated with this timer. |
void |
removeTimerCallback(LBMTimerCallback cb)
Deregister a timer callback |
void |
removeTimerCallback(LBMTimerCallback cb,
java.lang.Object cbArg)
Deregister a timer callback (and callback token) |
void |
reschedule(long milliseconds)
Reschedule this timer to expire in a specified number of milliseconds. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LBMTimer(LBMContext lbmctx, long milliseconds) throws LBMException
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.public LBMTimer(LBMContext lbmctx, long milliseconds, LBMEventQueue lbmevq) throws LBMException
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 timermilliseconds
- Number of milliseconds until the timer expireslbmevq
- 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.public LBMTimer(LBMContext lbmctx, long milliseconds, LBMTimerCallback cb, java.lang.Object cbArg) throws LBMException
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 expirescb
- An object implementing the LBMTimerCallback interfacecbArg
- Callback object passed as token to callback interface
LBMException
- if any timer scheduling error occurs.public LBMTimer(LBMContext lbmctx, long milliseconds, LBMTimerCallback cb, java.lang.Object cbArg, LBMEventQueue lbmevq) throws LBMException
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 timermilliseconds
- Number of milliseconds until the timer expireslbmevq
- Event queue with which to associate this timercb
- An object implementing the LBMTimerCallback interfacecbArg
- 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.Method Detail |
---|
public void addTimerCallback(LBMTimerCallback cb)
cb
- Object implementing the LBMTimerCallback interfaceLBMTimerCallback
,
removeTimerCallback(com.latencybusters.lbm.LBMTimerCallback)
public void addTimerCallback(LBMTimerCallback cb, java.lang.Object cbArg)
cb
- Object implementing the LBMTimerCallback interfacecbArg
- Callback token objectLBMTimerCallback
,
removeTimerCallback(com.latencybusters.lbm.LBMTimerCallback)
public void removeTimerCallback(LBMTimerCallback cb)
cb
- Previously registered object implementing the
LBMTimerCallback interfaceLBMTimerCallback
,
addTimerCallback(com.latencybusters.lbm.LBMTimerCallback)
public void removeTimerCallback(LBMTimerCallback cb, java.lang.Object cbArg)
cb
- Previously registered object implementing the
LBMTimerCallback interfacecbArg
- Callback token for previously registered objectLBMTimerCallback
,
addTimerCallback(com.latencybusters.lbm.LBMTimerCallback)
public void cancel() throws LBMException
LBMException
- if the timer was invalid or could not be cancelled.public void cancel(boolean rescheduling) throws LBMException
cancel()
method instead.
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.public void reschedule(long milliseconds) throws LBMException
milliseconds
- Number of milliseconds until this timer should
expire.
LBMException
- if any timer scheduling error occurs.public LBMContext context()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |