public class PeriodicRefreshingReaderProvider extends Object implements DirectoryBasedReaderProvider
ReaderProvider
shares IndexReader buffers among threads and
will return "recently" refreshed ReaderProvider
, which implies
query results might represent the state of a slightly out of date index.
The definition of "recently" refreshed is defined by configuration properties,
so the user can choose how much the index being out of date is acceptable.
In exchange of allowing slightly out of date query results, the fact that we
can cap the frequency of index reopening events can provide significant
performance improvements in some architectures.Modifier and Type | Class and Description |
---|---|
protected class |
PeriodicRefreshingReaderProvider.PerDirectoryLatestReader
An instance for each DirectoryProvider, pointing to the "current" ReaderUsagePair
for each DirectoryProvider.
|
protected class |
PeriodicRefreshingReaderProvider.ReaderUsagePair
Container for the couple IndexReader,UsageCounter.
|
Modifier and Type | Field and Description |
---|---|
protected Map<IndexReader,PeriodicRefreshingReaderProvider.ReaderUsagePair> |
allReaders
contains all Readers (most current per Directory and all unclosed old readers)
|
protected Map<Directory,PeriodicRefreshingReaderProvider.PerDirectoryLatestReader> |
currentReaders
contains last updated Reader; protected by lockOnOpenLatest (in the values)
|
static int |
DEFAULT_ACCEPTABLE_MAX_AGE_MS |
Constructor and Description |
---|
PeriodicRefreshingReaderProvider() |
Modifier and Type | Method and Description |
---|---|
void |
closeIndexReader(IndexReader reader) |
void |
initialize(DirectoryBasedIndexManager indexManager,
Properties props) |
IndexReader |
openIndexReader() |
protected DirectoryReader |
readerFactory(Directory directory) |
void |
stop() |
public static final int DEFAULT_ACCEPTABLE_MAX_AGE_MS
protected final Map<IndexReader,PeriodicRefreshingReaderProvider.ReaderUsagePair> allReaders
protected final Map<Directory,PeriodicRefreshingReaderProvider.PerDirectoryLatestReader> currentReaders
public IndexReader openIndexReader()
openIndexReader
in interface ReaderProvider
public void closeIndexReader(IndexReader reader)
closeIndexReader
in interface ReaderProvider
protected DirectoryReader readerFactory(Directory directory) throws IOException
IOException
public void initialize(DirectoryBasedIndexManager indexManager, Properties props)
initialize
in interface DirectoryBasedReaderProvider
public void stop()
stop
in interface DirectoryBasedReaderProvider
Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved