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.
  • Constructor Details

    • Virtual

      public Virtual()
  • Method Details

    • getTime

      public long getTime()
      Description copied from class: Clock
      Returns the current time in milliseconds since the epoch.

      Users of this class should use Clock.millis() instead. This abstract method remains here for cases where this class is extended.

      Specified by:
      getTime in class Clock
      Returns:
      current time in milliseconds since the epoch
      See Also:
    • 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 the Clock.getTimeIncreasing() method returns a time that's equal or greater than the given point in time.
      Overrides:
      waitUntil in class Clock
      Parameters:
      timestamp - time in milliseconds since epoch
    • toString

      public String toString()
      Overrides:
      toString in class Object