Package xal.tools.dispatch
Class DispatchTimer
java.lang.Object
xal.tools.dispatch.DispatchTimer
DispatchTimer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
possible dispatch modes -
Constructor Summary
ConstructorsConstructorDescriptionDispatchTimer
(DispatchQueue eventQueue, Runnable eventHandler) ConstructorDispatchTimer
(DispatchTimer.DispatchTimerMode dispatchMode, DispatchQueue eventQueue, Runnable eventHandler) Primary Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoid
cancel()
Cancel this timervoid
dispose()
dispose of this timer's resourcesprotected void
finalize()
release resources held by this timerstatic DispatchTimer
getCoalescingInstance
(DispatchQueue eventQueue, Runnable eventHandler) Create a new coalescing timerstatic DispatchTimer
getFixedRateInstance
(DispatchQueue eventQueue, Runnable eventHandler) Create a new fixed rate timerboolean
determine whether this timer has been disposedboolean
Determines whether this queue is suspended (disposed implies suspended)void
resume()
resume this timervoid
setCancelHandler
(Runnable cancelHandler) Set the cancel handler which is dispatched to the queue when the timer is canceledvoid
setEventHandler
(Runnable eventHandler) Set the event handler which is dispatched to the queue when the timer firesvoid
setStartTimeAndInterval
(Date startTime, long milliInterval, int nanoInterval) Set the time at which this timer starts and the interval between when the timer fires.void
startNowWithInterval
(long milliInterval, int nanoInterval) Start the timer now and set the interval between when the timer fires.void
suspend()
suspend this timer if it is processing (do nothing if disposed or already suspended)
-
Constructor Details
-
DispatchTimer
public DispatchTimer(DispatchTimer.DispatchTimerMode dispatchMode, DispatchQueue eventQueue, Runnable eventHandler) Primary Constructor -
DispatchTimer
Constructor
-
-
Method Details
-
getFixedRateInstance
Create a new fixed rate timer -
getCoalescingInstance
Create a new coalescing timer -
finalize
release resources held by this timer -
setEventHandler
Set the event handler which is dispatched to the queue when the timer fires -
setCancelHandler
Set the cancel handler which is dispatched to the queue when the timer is canceled -
startNowWithInterval
public void startNowWithInterval(long milliInterval, int nanoInterval) Start the timer now and set the interval between when the timer fires.- Parameters:
milliInterval
- milliseconds of the interval between when the timer firesnanoInterval
- nanoseconds of the interval between when the timer fires
-
setStartTimeAndInterval
Set the time at which this timer starts and the interval between when the timer fires.- Parameters:
milliInterval
- milliseconds of the interval between when the timer firesnanoInterval
- nanoseconds of the interval between when the timer fires
-
cancel
public void cancel()Cancel this timer -
isSuspended
public boolean isSuspended()Determines whether this queue is suspended (disposed implies suspended) -
suspend
public void suspend()suspend this timer if it is processing (do nothing if disposed or already suspended) -
resume
public void resume()resume this timer -
dispose
public void dispose()dispose of this timer's resources -
isDisposed
public boolean isDisposed()determine whether this timer has been disposed
-