Class Clocks
java.lang.Object
com.apple.foundationdb.relational.util.Clocks
Utility class for creating different clock instances.
-
Method Summary
Modifier and TypeMethodDescriptionstatic Clock
logicalClock
(AtomicLong ticker) Get a logical clock based off the specified underlying ticker object.static Clock
Get a clock which reads nano time from the System clock.
-
Method Details
-
systemClock
Get a clock which reads nano time from the System clock.- Returns:
- a clock which reads 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.
-