public class SharingBufferReaderProvider extends Object implements DirectoryBasedReaderProvider
ReaderProvider shares IndexReaders as long as they are "current";
It 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.| Modifier and Type | Class and Description |
|---|---|
protected class |
SharingBufferReaderProvider.PerDirectoryLatestReader
An instance for each DirectoryProvider,
establishing the association between "current" ReaderUsagePair
for a DirectoryProvider and it's lock.
|
protected class |
SharingBufferReaderProvider.ReaderUsagePair
Container for the couple IndexReader,UsageCounter.
|
| Modifier and Type | Field and Description |
|---|---|
protected Map<org.apache.lucene.index.IndexReader,SharingBufferReaderProvider.ReaderUsagePair> |
allReaders
contains all Readers (most current per Directory and all unclosed old readers)
|
protected Map<org.apache.lucene.store.Directory,SharingBufferReaderProvider.PerDirectoryLatestReader> |
currentReaders
contains last updated Reader; protected by lockOnOpenLatest (in the values)
|
| Constructor and Description |
|---|
SharingBufferReaderProvider() |
| Modifier and Type | Method and Description |
|---|---|
void |
closeIndexReader(org.apache.lucene.index.IndexReader reader) |
void |
initialize(DirectoryBasedIndexManager indexManager,
Properties props) |
org.apache.lucene.index.IndexReader |
openIndexReader() |
protected org.apache.lucene.index.IndexReader |
readerFactory(org.apache.lucene.store.Directory directory) |
void |
stop() |
protected final Map<org.apache.lucene.index.IndexReader,SharingBufferReaderProvider.ReaderUsagePair> allReaders
protected final Map<org.apache.lucene.store.Directory,SharingBufferReaderProvider.PerDirectoryLatestReader> currentReaders
public org.apache.lucene.index.IndexReader openIndexReader()
openIndexReader in interface ReaderProviderpublic void closeIndexReader(org.apache.lucene.index.IndexReader reader)
closeIndexReader in interface ReaderProviderpublic void initialize(DirectoryBasedIndexManager indexManager, Properties props)
initialize in interface DirectoryBasedReaderProviderpublic void stop()
stop in interface DirectoryBasedReaderProviderprotected org.apache.lucene.index.IndexReader readerFactory(org.apache.lucene.store.Directory directory)
throws IOException
IOExceptionCopyright © 2006–2015 Hibernate. All rights reserved.