Package com.illumon.iris.utils
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 byget()
to the default value.static void
set(com.fishlib.base.clock.Clock newTimesource)
Set the Clock that will be returned byget()
.
-
Constructor Details
-
ClockFactory
public ClockFactory()
-
-
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 byget()
. -
reset
public static void reset()Reset the Clock that will be returned byget()
to the default value.
-