Class StageClock

java.lang.Object
swim.concurrent.Clock
swim.concurrent.StageClock
All Implemented Interfaces:
Schedule

public class StageClock extends Clock
Clock that invokes timer functions on an execution Stage, rather than on the clock thread.
  • Field Details

    • stage

      protected final Stage stage
      Stage on which to execute timer functions.
  • Constructor Details

    • StageClock

      public StageClock(Stage stage, int tickMillis, int tickCount)
      Constructs a new StageClock with a timer resolution of tickMillis milliseconds, and a clock period of tickCount ticks per revolution, that executes timer functions on the given stage.
    • StageClock

      public StageClock(Stage stage, ClockDef clockDef)
      Constructs a new StageClock, with the timer resolution and clock period specified by the given clockDef, that executes timer functions on the given stage.
    • StageClock

      public StageClock(Stage stage)
      Constructs a new StageClock with a timer resolution of Clock.TICK_MILLIS milliseconds, and a clock period of Clock.TICK_COUNT ticks per revolution, that executes timer functions on the given stage.
  • Method Details

    • stage

      public final Stage stage()
      Returns the stage on which to execute timer functions.
    • runTimer

      protected void runTimer(TimerFunction timer, Runnable runnable)
      Schedules the runnable to invoke timer.runTimer() on the execution stage.
      Overrides:
      runTimer in class Clock