Package org.apache.cassandra.utils
Interface MonotonicClock
-
- All Known Implementing Classes:
MonotonicClock.AbstractEpochSamplingClock,MonotonicClock.SampledClock,MonotonicClock.SystemClock
public interface MonotonicClockWrapper around time related functions that are either implemented by using the default JVM calls or by using a custom implementation for testing purposes. SeepreciseTimefor how to use a custom implementation. Please note thatClockwasn'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 classMonotonicClock.AbstractEpochSamplingClockstatic classMonotonicClock.Defaultsstatic classMonotonicClock.SampledClockstatic classMonotonicClock.SystemClock
-
Field Summary
Fields Modifier and Type Field Description static MonotonicClockapproxTimestatic MonotonicClockpreciseTimeStatic 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 longerror()booleanisAfter(long instant)booleanisAfter(long now, long instant)longnow()MonotonicClockTranslationtranslate()
-
-
-
Field Detail
-
preciseTime
static final MonotonicClock preciseTime
Static singleton object that will be instantiated by default with a system clock implementation. Setcassandra.clocksystem 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)
-
-