public class DispatchTimer
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
DispatchTimer.DispatchTimerMode
possible dispatch modes
|
Constructor and Description |
---|
DispatchTimer(DispatchQueue eventQueue,
java.lang.Runnable eventHandler)
Constructor
|
DispatchTimer(DispatchTimer.DispatchTimerMode dispatchMode,
DispatchQueue eventQueue,
java.lang.Runnable eventHandler)
Primary Constructor
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancel this timer
|
void |
dispose()
dispose of this timer's resources
|
protected void |
finalize()
release resources held by this timer
|
static DispatchTimer |
getCoalescingInstance(DispatchQueue eventQueue,
java.lang.Runnable eventHandler)
Create a new coalescing timer
|
static DispatchTimer |
getFixedRateInstance(DispatchQueue eventQueue,
java.lang.Runnable eventHandler)
Create a new fixed rate timer
|
boolean |
isDisposed()
determine whether this timer has been disposed
|
boolean |
isSuspended()
Determines whether this queue is suspended (disposed implies suspended)
|
void |
resume()
resume this timer
|
void |
setCancelHandler(java.lang.Runnable cancelHandler)
Set the cancel handler which is dipsatched to the queue when the timer is canceled
|
void |
setEventHandler(java.lang.Runnable eventHandler)
Set the event handler which is dispatched to the queue when the timer fires
|
void |
setStartTimeAndInterval(java.util.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)
|
public DispatchTimer(DispatchTimer.DispatchTimerMode dispatchMode, DispatchQueue eventQueue, java.lang.Runnable eventHandler)
public DispatchTimer(DispatchQueue eventQueue, java.lang.Runnable eventHandler)
public static DispatchTimer getFixedRateInstance(DispatchQueue eventQueue, java.lang.Runnable eventHandler)
public static DispatchTimer getCoalescingInstance(DispatchQueue eventQueue, java.lang.Runnable eventHandler)
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public void setEventHandler(java.lang.Runnable eventHandler)
public void setCancelHandler(java.lang.Runnable cancelHandler)
public void startNowWithInterval(long milliInterval, int nanoInterval)
milliInterval
- milliseconds of the interval between when the timer firesnanoInterval
- nanoseconds of the interval between when the timer firespublic void setStartTimeAndInterval(java.util.Date startTime, long milliInterval, int nanoInterval)
milliInterval
- milliseconds of the interval between when the timer firesnanoInterval
- nanoseconds of the interval between when the timer firespublic void cancel()
public boolean isSuspended()
public void suspend()
public void resume()
public void dispose()
public boolean isDisposed()