UM Java API 6.17.1

- Main Page
- Related Pages
- Classes

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | List of all members
com.latencybusters.lbm.LBMTimer Class Reference

## 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 ()

## Detailed Description

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 & Destructor Documentation

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.

Parameters

  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

Exceptions

  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.

Parameters

  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)

Exceptions

  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.

Parameters

  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

Exceptions

  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.

Parameters

  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)

Exceptions

  LBMException | if any timer scheduling error occurs.

References com.latencybusters.lbm.LBMTimer.addTimerCallback().

## Member Function Documentation

void com.latencybusters.lbm.LBMTimer.addTimerCallback | ( | LBMTimerCallback | cb | ) |

Register a timer callback

Parameters

  cb | Object implementing the LBMTimerCallback interface

See also
  LBMTimerCallback
  removeTimerCallback

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)

Parameters

  cb | Object implementing the LBMTimerCallback interface
  cbArg | Callback token object

See also
  LBMTimerCallback
  removeTimerCallback

void com.latencybusters.lbm.LBMTimer.cancel | ( |  | ) | throws LBMException

Cancel timer

Exceptions

  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

Parameters

  rescheduling | External users should always pass in false. Unexpected behavior may result if true is passed in.

Exceptions

  LBMException | if the timer was invalid or could not be cancelled.

Deprecated:
  This method is provided for backwards compatibility with LBM 3.3.7/UME 2.0.5; please use the cancel() method instead.

LBMContext com.latencybusters.lbm.LBMTimer.context | ( |  | ) |

Get the LBMContext object associated with this timer.

Returns
  An LBMContext object.

void com.latencybusters.lbm.LBMTimer.removeTimerCallback | ( | LBMTimerCallback | cb | ) |

Deregister a timer callback

Parameters

  cb | Previously registered object implementing the LBMTimerCallback interface

See also
  LBMTimerCallback
  addTimerCallback

void com.latencybusters.lbm.LBMTimer.removeTimerCallback | ( | LBMTimerCallback | cb,
|  | Object | cbArg
| ) |  |

Deregister a timer callback (and callback token)

Parameters

  cb | Previously registered object implementing the LBMTimerCallback interface
  cbArg | Callback token for previously registered object

See also
  LBMTimerCallback
  addTimerCallback

void com.latencybusters.lbm.LBMTimer.reschedule | ( | long | milliseconds | ) | throws LBMException

Reschedule this timer to expire in a specified number of milliseconds.

Parameters

  milliseconds | Number of milliseconds until this timer should expire.

Exceptions

  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().

The documentation for this class was generated from the following file:

- LBMTimer.java