|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.apache.lucene.search.ReferenceManager<DirectoryReader>
org.apache.lucene.index.ReaderManager
public final class ReaderManager
Utility class to safely share DirectoryReader instances across
multiple threads, while periodically reopening. This class ensures each
reader is closed only once all threads have finished using it.
SearcherManager| Field Summary |
|---|
| Fields inherited from class org.apache.lucene.search.ReferenceManager |
|---|
current |
| Constructor Summary | |
|---|---|
ReaderManager(Directory dir)
Creates and returns a new ReaderManager from the given Directory. |
|
ReaderManager(IndexWriter writer,
boolean applyAllDeletes)
Creates and returns a new ReaderManager from the given IndexWriter. |
|
| Method Summary | |
|---|---|
protected void |
decRef(DirectoryReader reference)
Decrement reference counting on the given reference. |
protected DirectoryReader |
refreshIfNeeded(DirectoryReader referenceToRefresh)
Refresh the given reference if needed. |
protected boolean |
tryIncRef(DirectoryReader reference)
Try to increment reference counting on the given reference. |
| Methods inherited from class org.apache.lucene.search.ReferenceManager |
|---|
acquire, afterClose, afterRefresh, close, maybeRefresh, maybeRefreshBlocking, release |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReaderManager(IndexWriter writer,
boolean applyAllDeletes)
throws IOException
IndexWriter.
writer - the IndexWriter to open the IndexReader from.applyAllDeletes - If true, all buffered deletes will be applied (made
visible) in the IndexSearcher / DirectoryReader.
If false, the deletes may or may not be applied, but
remain buffered (in IndexWriter) so that they will be applied in
the future. Applying deletes can be costly, so if your app can
tolerate deleted documents being returned you might gain some
performance by passing false. See
DirectoryReader.openIfChanged(DirectoryReader, IndexWriter, boolean).
IOException - If there is a low-level I/O error
public ReaderManager(Directory dir)
throws IOException
Directory.
dir - the directory to open the DirectoryReader on.
IOException - If there is a low-level I/O error| Method Detail |
|---|
protected void decRef(DirectoryReader reference)
throws IOException
ReferenceManager
decRef in class ReferenceManager<DirectoryReader>IOException
protected DirectoryReader refreshIfNeeded(DirectoryReader referenceToRefresh)
throws IOException
ReferenceManagernull if no refresh
was needed, otherwise a new refreshed reference.
refreshIfNeeded in class ReferenceManager<DirectoryReader>IOExceptionprotected boolean tryIncRef(DirectoryReader reference)
ReferenceManager
tryIncRef in class ReferenceManager<DirectoryReader>
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||