Class Clocks
java.lang.Object
com.apple.foundationdb.relational.util.Clocks
Utility class for creating different clock instances.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ClocklogicalClock(AtomicLong ticker) Get a logical clock based off the specified underlying ticker object.static ClockReturns a clock which reads nano time from the system clock.
-
Method Details
-
systemClock
Returns a clock which reads nano time from the system clock.- Returns:
- a clock which reads nano time from the system clock
-
logicalClock
Get a logical clock based off the specified underlying ticker object.When using a logical ticker, it is important that the clock not be set backwards (otherwise, algorithms may have weird results). This is a problem with all clocks, but is much more easily produced using logical clocks like this.
- Parameters:
ticker- the underlying counter.- Returns:
- a clock which uses the underlying ticker to tell logical time.
-