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. SeepreciseTime
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()
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
MonotonicClock.AbstractEpochSamplingClock
static class
MonotonicClock.Defaults
static class
MonotonicClock.SampledClock
static class
MonotonicClock.SystemClock
-
Field Summary
Fields Modifier and Type Field Description static MonotonicClock
approxTime
static MonotonicClock
preciseTime
Static singleton object that will be instantiated by default with a system clock implementation.
-
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()
-
-
-
Field Detail
-
preciseTime
static final MonotonicClock preciseTime
Static singleton object that will be instantiated by default with a system clock implementation. Setcassandra.clock
system property to a FQCN to use a different implementation instead.
-
approxTime
static final MonotonicClock approxTime
-
-
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)
-
-