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.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
-
Methods inherited from class java.time.Clock
equals, fixed, hashCode, millis, offset, system, systemDefaultZone, systemUTC, tick, tickMillis, tickMinutes, tickSeconds
-
-
-
-
Method Detail
-
getTime
public long getTime()
Description copied from class:Clock
Returns the current time in milliseconds since the epoch.- Specified by:
getTime
in classClock
- Returns:
- current time in milliseconds since the epoch
- See Also:
System.currentTimeMillis()
,Clock.millis()
-
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.
-
-