Class DefaultTimingSource
java.lang.Object
org.hibernate.search.engine.common.timing.impl.DefaultTimingSource
- All Implemented Interfaces:
TimingSource
Default implementation for a
TimingSource- Since:
- 4.1
- Author:
- Sanne Grinovero (C) 2012 Red Hat Inc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidNeeds to be invoked at least once beforeTimingSource.monotonicTimeEstimate()can be used.longReturns an approximation ofSystem.nanoTime().longnanoTime()Returns current system time in nanoseconds.voidstop()Invoked on engine integration shutdown.
-
Constructor Details
-
DefaultTimingSource
-
-
Method Details
-
monotonicTimeEstimate
public long monotonicTimeEstimate()Description copied from interface:TimingSourceReturns an approximation ofSystem.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:
monotonicTimeEstimatein interfaceTimingSource- 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:TimingSourceNeeds to be invoked at least once beforeTimingSource.monotonicTimeEstimate()can be used. Safe to be invoked multiple times.- Specified by:
ensureTimeEstimateIsInitializedin interfaceTimingSource
-
nanoTime
public long nanoTime()Description copied from interface:TimingSourceReturns current system time in nanoseconds. Accuracy is preferred over performance by the implementation.- Specified by:
nanoTimein interfaceTimingSource- Returns:
- high precision current time in nanoseconds.
-
stop
public void stop()Description copied from interface:TimingSourceInvoked on engine integration shutdown. There is no start method as it's expected to be lazily initialized- Specified by:
stopin interfaceTimingSource
-