Package org.hibernate.search.reader
Class SharingBufferReaderProvider
java.lang.Object
org.hibernate.search.reader.SharingBufferReaderProvider
- All Implemented Interfaces:
ReaderProvider
This
ReaderProvider shares IndexReaders as long as they are "current";
main difference with SharedReaderProvider is the way to update the Readers when needed:
this uses IndexReader.reopen() which should improve performance on larger indexes
as it shares buffers with previous IndexReader generation for the segments which didn't change.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected final classAn instance for each DirectoryProvider, establishing the association between "current" ReaderUsagePair for a DirectoryProvider and it's lock.protected final classContainer for the couple IndexReader,UsageCounter. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<IndexReader, SharingBufferReaderProvider.ReaderUsagePair> contains all Readers (most current per Directory and all unclosed old readers)protected final Map<Directory, SharingBufferReaderProvider.PerDirectoryLatestReader> contains last updated Reader; protected by lockOnOpenLatest (in the values) -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcloseReader(IndexReader multiReader) Close a reader previously opened byReaderProvider.openReader(org.hibernate.search.store.DirectoryProvider...).voiddestroy()Called when aSearchFactoryis destroyed.voidinitialize(Properties props, BuildContext context) Initialize the reader provider before its use.openReader(DirectoryProvider... directoryProviders) Open a read-only reader on all the listed directory providers.protected IndexReaderreaderFactory(Directory directory)
-
Field Details
-
allReaders
contains all Readers (most current per Directory and all unclosed old readers) -
currentReaders
contains last updated Reader; protected by lockOnOpenLatest (in the values)
-
-
Constructor Details
-
SharingBufferReaderProvider
public SharingBufferReaderProvider()
-
-
Method Details
-
closeReader
Description copied from interface:ReaderProviderClose a reader previously opened byReaderProvider.openReader(org.hibernate.search.store.DirectoryProvider...). The closing can be virtual.- Specified by:
closeReaderin interfaceReaderProvider
-
initialize
Description copied from interface:ReaderProviderInitialize the reader provider before its use.- Specified by:
initializein interfaceReaderProvider
-
destroy
public void destroy()Description copied from interface:ReaderProviderCalled when aSearchFactoryis destroyed. This method typically releases resources. It is guaranteed to be executed after readers are released by queries (assuming no user error).- Specified by:
destroyin interfaceReaderProvider
-
openReader
Description copied from interface:ReaderProviderOpen a read-only reader on all the listed directory providers. The opened reader has to be closed throughReaderProvider.closeReader(IndexReader). The opening can be virtual.- Specified by:
openReaderin interfaceReaderProvider
-
readerFactory
- Throws:
IOException
-