Package org.apache.jackrabbit.oak.stats
Class Clock.Virtual
- java.lang.Object
-
- java.time.Clock
-
- org.apache.jackrabbit.oak.stats.Clock
-
- org.apache.jackrabbit.oak.stats.Clock.Virtual
-
- Enclosing class:
- Clock
public static class Clock.Virtual extends Clock
A virtual clock that has no connection to the actual system time. Instead the clock maintains an internal counter that's incremented atomically whenever the current time is requested. This guarantees that the reported time signal is always strictly increasing.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.jackrabbit.oak.stats.Clock
Clock.Fast, Clock.Virtual
-
-
Constructor Summary
Constructors Constructor Description Virtual()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
getTime()
Returns the current time in milliseconds since the epoch.java.lang.String
toString()
void
waitUntil(long timestamp)
Waits until the given point in time is reached.-
Methods inherited from class org.apache.jackrabbit.oak.stats.Clock
getDate, getDateIncreasing, getDateMonotonic, getTimeIncreasing, getTimeMonotonic, getZone, instant, withZone
-
-
-
-
Method Detail
-
getTime
public long getTime()
Description copied from class:Clock
Returns the current time in milliseconds since the epoch.
-
waitUntil
public void waitUntil(long timestamp)
Description copied from class:Clock
Waits until the given point in time is reached. The current thread is suspended until theClock.getTimeIncreasing()
method returns a time that's equal or greater than the given point in time.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-