org.hibernate.search.engine.spi

## Interface TimingSource

- All Known Implementing Classes:
    DefaultTimingSource

      public interface TimingSource

  Lucene delegates responsibility for efficient time tracking to an external service; this is needed for example by the `TimeLimitingCollector.TimeLimitingCollector(org.apache.lucene.search.Collector, org.apache.lucene.util.Counter, long)` used by Hibernate Search when time limits are enabled on fulltext queries.
  Since:
    4.1
  Author:
    Sanne Grinovero (C) 2012 Red Hat Inc.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `ensureInitialized()` Needs to be invoked at least once before `getMonotonicTimeEstimate()` can be used.
    `long` | `getMonotonicTimeEstimate()` Returns an approximation of `System.nanoTime()`.
    `void` | `stop()` Invoked on SearchIntegrator shutdown.

- - ### Method Detail

    - #### getMonotonicTimeEstimate

          long getMonotonicTimeEstimate()

      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.
      Returns:
        an increasing value related to time in milliseconds. Only meaningful to compare time intervals, with no guarantees of high precision.

    - #### stop

          void stop()

      Invoked on SearchIntegrator shutdown. There is no start method as it's expected to be lazily initialized

    - #### ensureInitialized

          void ensureInitialized()

      Needs to be invoked at least once before `getMonotonicTimeEstimate()` can be used. Safe to be invoked multiple times.

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved