Class DispatchTimer

java.lang.Object
xal.tools.dispatch.DispatchTimer

public class DispatchTimer extends Object
DispatchTimer
  • Constructor Details

  • Method Details

    • getFixedRateInstance

      public static DispatchTimer getFixedRateInstance(DispatchQueue eventQueue, Runnable eventHandler)
      Create a new fixed rate timer
    • getCoalescingInstance

      public static DispatchTimer getCoalescingInstance(DispatchQueue eventQueue, Runnable eventHandler)
      Create a new coalescing timer
    • finalize

      protected void finalize() throws Throwable
      release resources held by this timer
      Overrides:
      finalize in class Object
      Throws:
      Throwable
    • setEventHandler

      public void setEventHandler(Runnable eventHandler)
      Set the event handler which is dispatched to the queue when the timer fires
    • setCancelHandler

      public void setCancelHandler(Runnable cancelHandler)
      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 fires
      nanoInterval - nanoseconds of the interval between when the timer fires
    • setStartTimeAndInterval

      public void setStartTimeAndInterval(Date startTime, long milliInterval, int nanoInterval)
      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 fires
      nanoInterval - 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