Utility class to manage sharing near-real-time searchers
across multiple searching thread. The difference vs
SearcherManager is that this class enables individual
requests to wait until specific indexing changes are
visible.

You must create an IndexWriter, then create a NRTManager.TrackingIndexWriter from it, and pass that to the
NRTManager. You may want to create two NRTManagers, once
that always applies deletes on refresh and one that does
not. In this case you should use a single NRTManager.TrackingIndexWriter instance for both.

NRTManager

Expert: just like NRTManager(TrackingIndexWriter,SearcherFactory),
but you can also specify whether each reopened searcher must
apply deletes. This is useful for cases where certain
uses can tolerate seeing some deleted docs, since
reopen time is faster if deletes need not be applied.

removeWaitingListener

waitForGeneration

public void waitForGeneration(long targetGen)

Waits for the target generation to become visible in
the searcher.
If the current searcher is older than the
target generation, this method will block
until the searcher is reopened, by another via
ReferenceManager.maybeRefresh() or until the NRTManager is closed.

Parameters:

targetGen - the generation to wait for

waitForGeneration

public void waitForGeneration(long targetGen,
long time,
TimeUnit unit)

Waits for the target generation to become visible in
the searcher. If the current searcher is older than
the target generation, this method will block until the
searcher has been reopened by another thread via
ReferenceManager.maybeRefresh(), the given waiting time has elapsed, or until
the NRTManager is closed.

NOTE: if the waiting time elapses before the requested target generation is
available the current SearcherManager is returned instead.