Class NotSharedIndexReaderProvider
- java.lang.Object
-
- org.hibernate.search.backend.lucene.lowlevel.reader.impl.NotSharedIndexReaderProvider
-
- All Implemented Interfaces:
IndexReaderProvider
public class NotSharedIndexReaderProvider extends Object implements IndexReaderProvider
A simplistic index reader holder that opens a new index reader from the directory every time an index reader is requested.
-
-
Constructor Summary
Constructors Constructor Description NotSharedIndexReaderProvider(DirectoryHolder directoryHolder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()Closes and drops any cached resources (index readers in particular).org.apache.lucene.index.DirectoryReadergetOrCreate()voidrefresh()Make sure the index reader returned by the next call toIndexReaderProvider.getOrCreate()will return an up-to-date view of the index.
-
-
-
Constructor Detail
-
NotSharedIndexReaderProvider
public NotSharedIndexReaderProvider(DirectoryHolder directoryHolder)
-
-
Method Detail
-
clear
public void clear()
Description copied from interface:IndexReaderProviderCloses and drops any cached resources (index readers in particular).Should be used when stopping the index or to clean up upon error.
- Specified by:
clearin interfaceIndexReaderProvider
-
refresh
public void refresh()
Description copied from interface:IndexReaderProviderMake sure the index reader returned by the next call toIndexReaderProvider.getOrCreate()will return an up-to-date view of the index.- Specified by:
refreshin interfaceIndexReaderProvider
-
getOrCreate
public org.apache.lucene.index.DirectoryReader getOrCreate() throws IOException- Specified by:
getOrCreatein interfaceIndexReaderProvider- Returns:
- A ready-to-use index reader, with its reference count already increased.
Callers are responsible for calling
IndexReader.decRef()when they are done with the index reader. Callers must not callIndexReader.close(), as the index reader may be shared. - Throws:
IOException
-
-