Package org.apache.cassandra.utils
Interface MonotonicClock
-
- All Known Implementing Classes:
MonotonicClock.AbstractEpochSamplingClock
,MonotonicClock.SampledClock
,MonotonicClock.SystemClock
public interface MonotonicClock
Wrapper around time related functions that are either implemented by using the default JVM calls or by using a custom implementation for testing purposes. SeeMonotonicClock.Global.preciseTime
for how to use a custom implementation. Please note thatClock
wasn't used, as it would not be possible to provide an implementation fornow()
with the exact same properties ofSystem.nanoTime()
. TODO better rationalise MonotonicClock/Clock
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
MonotonicClock.AbstractEpochSamplingClock
static class
MonotonicClock.Global
static class
MonotonicClock.SampledClock
static class
MonotonicClock.SystemClock
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description long
error()
boolean
isAfter(long instant)
boolean
isAfter(long now, long instant)
long
now()
MonotonicClockTranslation
translate()
-
-
-
Method Detail
-
now
long now()
- See Also:
Provides a monotonic time that can be compared with any other such value produced by the same clock since the application started only; these times cannot be persisted or serialized to other nodes. Nanosecond precision.
-
error
long error()
- Returns:
- nanoseconds of potential error
-
translate
MonotonicClockTranslation translate()
-
isAfter
boolean isAfter(long instant)
-
isAfter
boolean isAfter(long now, long instant)
-
-