org.hibernate.search.engine.impl
Class DefaultTimingSource

java.lang.Object
  extended by org.hibernate.search.engine.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 Summary
DefaultTimingSource()
           
 
Method Summary
 void ensureInitialized()
          Needs to be invoked at least once before TimingSource.getMonotonicTimeEstimate() can be used.
 long getMonotonicTimeEstimate()
          Returns and approximation of System.nanoTime().
 void stop()
          Invoked on SearchFactory shutdown.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTimingSource

public DefaultTimingSource()
Method Detail

getMonotonicTimeEstimate

public long getMonotonicTimeEstimate()
Description copied from interface: TimingSource
Returns and 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:
getMonotonicTimeEstimate in interface TimingSource
Returns:
an increasing value related to time in milliseconds. Only meaningful to compare time intervals, with no guarantees of high precision.

ensureInitialized

public void ensureInitialized()
Description copied from interface: TimingSource
Needs to be invoked at least once before TimingSource.getMonotonicTimeEstimate() can be used. Safe to be invoked multiple times.

Specified by:
ensureInitialized in interface TimingSource

stop

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

Specified by:
stop in interface TimingSource


Copyright © 2006-2012 Red Hat Middleware, LLC. All Rights Reserved