Package xal.tools.dispatch
Class DispatchTimer
java.lang.Object
xal.tools.dispatch.DispatchTimer
DispatchTimer
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumpossible dispatch modes -
Constructor Summary
ConstructorsConstructorDescriptionDispatchTimer(DispatchQueue eventQueue, Runnable eventHandler) ConstructorDispatchTimer(DispatchTimer.DispatchTimerMode dispatchMode, DispatchQueue eventQueue, Runnable eventHandler) Primary Constructor -
Method Summary
Modifier and TypeMethodDescriptionvoidcancel()Cancel this timervoiddispose()dispose of this timer's resourcesprotected voidfinalize()release resources held by this timerstatic DispatchTimergetCoalescingInstance(DispatchQueue eventQueue, Runnable eventHandler) Create a new coalescing timerstatic DispatchTimergetFixedRateInstance(DispatchQueue eventQueue, Runnable eventHandler) Create a new fixed rate timerbooleandetermine whether this timer has been disposedbooleanDetermines whether this queue is suspended (disposed implies suspended)voidresume()resume this timervoidsetCancelHandler(Runnable cancelHandler) Set the cancel handler which is dispatched to the queue when the timer is canceledvoidsetEventHandler(Runnable eventHandler) Set the event handler which is dispatched to the queue when the timer firesvoidsetStartTimeAndInterval(Date startTime, long milliInterval, int nanoInterval) Set the time at which this timer starts and the interval between when the timer fires.voidstartNowWithInterval(long milliInterval, int nanoInterval) Start the timer now and set the interval between when the timer fires.voidsuspend()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
-