Class ClockFactory

java.lang.Object
com.illumon.iris.utils.ClockFactory

public class ClockFactory
extends Object
This is a hook to enable testing and simulation. Users of Clock should use this factory to get an instance. When they do, it is possible to change the class behavior from a test harness. Note: This would be better housed as a member of Clock.
  • Constructor Summary

    Constructors 
    Constructor Description
    ClockFactory()  
  • Method Summary

    Modifier and Type Method Description
    static com.fishlib.base.clock.Clock get()
    Get the current Clock.
    static com.fishlib.base.clock.Clock getDefault()
    Get the default (System) Clock.
    static void reset()
    Reset the Clock that will be returned by get() to the default value.
    static void set​(com.fishlib.base.clock.Clock newTimesource)
    Set the Clock that will be returned by get().

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • get

      public static com.fishlib.base.clock.Clock get()
      Get the current Clock.
      Returns:
      the current Clock
    • getDefault

      public static com.fishlib.base.clock.Clock getDefault()
      Get the default (System) Clock.
      Returns:
      the default WallClock
    • set

      public static void set​(com.fishlib.base.clock.Clock newTimesource)
      Set the Clock that will be returned by get().
    • reset

      public static void reset()
      Reset the Clock that will be returned by get() to the default value.