Class DefaultTimingSource

java.lang.Object
org.hibernate.search.engine.common.timing.impl.DefaultTimingSource
All Implemented Interfaces:
TimingSource

public final class DefaultTimingSource extends Object implements TimingSource
Default implementation for a TimingSource
Since:
4.1
Author:
Sanne Grinovero (C) 2012 Red Hat Inc.
  • Constructor Details

    • DefaultTimingSource

      public DefaultTimingSource(EngineThreads threads)
  • Method Details

    • monotonicTimeEstimate

      public long monotonicTimeEstimate()
      Description copied from interface: TimingSource
      Returns an approximation of System.nanoTime(). Performance should be preferred over accuracy by the implementation, but the value is monotonic and expresses time in milliseconds, however, subsequent invocations could return the same value.
      Specified by:
      monotonicTimeEstimate in interface TimingSource
      Returns:
      an increasing value related to time in milliseconds. Only meaningful to compare time intervals, with no guarantees of high precision.
    • ensureTimeEstimateIsInitialized

      public void ensureTimeEstimateIsInitialized()
      Description copied from interface: TimingSource
      Needs to be invoked at least once before TimingSource.monotonicTimeEstimate() can be used. Safe to be invoked multiple times.
      Specified by:
      ensureTimeEstimateIsInitialized in interface TimingSource
    • nanoTime

      public long nanoTime()
      Description copied from interface: TimingSource
      Returns current system time in nanoseconds. Accuracy is preferred over performance by the implementation.
      Specified by:
      nanoTime in interface TimingSource
      Returns:
      high precision current time in nanoseconds.
    • stop

      public void stop()
      Description copied from interface: TimingSource
      Invoked on engine integration shutdown. There is no start method as it's expected to be lazily initialized
      Specified by:
      stop in interface TimingSource