de.pangaea.metadataportal.utils
Class AutoCloseIndexReader

java.lang.Object
  extended by org.apache.lucene.index.IndexReader
      extended by org.apache.lucene.index.FilterIndexReader
          extended by de.pangaea.metadataportal.utils.AutoCloseIndexReader
All Implemented Interfaces:
Closeable, Cloneable

public final class AutoCloseIndexReader
extends FilterIndexReader

AutoCloseIndexReader is used by IndexConfig.getSharedIndexReader() to make IndexReaders cleanup by GC possible.

Author:
Uwe Schindler

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.lucene.index.FilterIndexReader
FilterIndexReader.FilterTermDocs, FilterIndexReader.FilterTermEnum, FilterIndexReader.FilterTermPositions
 
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
IndexReader.ReaderClosedListener
 
Field Summary
 
Fields inherited from class org.apache.lucene.index.FilterIndexReader
in
 
Fields inherited from class org.apache.lucene.index.IndexReader
hasChanges
 
Constructor Summary
AutoCloseIndexReader(IndexReader in, String name)
           
 
Method Summary
protected  void doClose()
           
protected  IndexReader doOpenIfChanged()
           
protected  IndexReader doOpenIfChanged(boolean openReadOnly)
          Deprecated. 
protected  IndexReader doOpenIfChanged(IndexCommit commit)
           
protected  IndexReader doOpenIfChanged(IndexWriter writer, boolean applyAllDeletes)
           
protected  void finalize()
          Close the index automatically.
 void hardClose()
           
 
Methods inherited from class org.apache.lucene.index.FilterIndexReader
directory, docFreq, doCommit, document, doDelete, doSetNorm, doUndeleteAll, getCommitUserData, getCoreCacheKey, getDeletesCacheKey, getFieldInfos, getIndexCommit, getSequentialSubReaders, getTermFreqVector, getTermFreqVector, getTermFreqVector, getTermFreqVectors, getTermInfosIndexDivisor, getUniqueTermCount, getVersion, hasDeletions, hasNorms, isCurrent, isDeleted, isOptimized, maxDoc, norms, norms, numDocs, termDocs, termDocs, termPositions, terms, terms, toString
 
Methods inherited from class org.apache.lucene.index.IndexReader
acquireWriteLock, addReaderClosedListener, clone, clone, close, commit, commit, decRef, deleteDocument, deleteDocuments, document, ensureOpen, flush, flush, getCommitUserData, getCurrentVersion, getRefCount, incRef, indexExists, lastModified, listCommits, numDeletedDocs, open, open, open, open, open, open, open, open, open, open, open, openIfChanged, openIfChanged, openIfChanged, openIfChanged, removeReaderClosedListener, reopen, reopen, reopen, reopen, setNorm, setNorm, termPositions, tryIncRef, undeleteAll
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AutoCloseIndexReader

public AutoCloseIndexReader(IndexReader in,
                            String name)
Method Detail

doClose

protected final void doClose()
                      throws IOException
Overrides:
doClose in class FilterIndexReader
Throws:
IOException

doOpenIfChanged

protected IndexReader doOpenIfChanged()
                               throws CorruptIndexException,
                                      IOException
Overrides:
doOpenIfChanged in class IndexReader
Throws:
CorruptIndexException
IOException

doOpenIfChanged

@Deprecated
protected IndexReader doOpenIfChanged(boolean openReadOnly)
                               throws CorruptIndexException,
                                      IOException
Deprecated. 

Overrides:
doOpenIfChanged in class IndexReader
Throws:
CorruptIndexException
IOException

doOpenIfChanged

protected IndexReader doOpenIfChanged(IndexCommit commit)
                               throws CorruptIndexException,
                                      IOException
Overrides:
doOpenIfChanged in class IndexReader
Throws:
CorruptIndexException
IOException

doOpenIfChanged

protected IndexReader doOpenIfChanged(IndexWriter writer,
                                      boolean applyAllDeletes)
                               throws CorruptIndexException,
                                      IOException
Overrides:
doOpenIfChanged in class IndexReader
Throws:
CorruptIndexException
IOException

hardClose

public final void hardClose()
                     throws CorruptIndexException,
                            IOException
Throws:
CorruptIndexException
IOException

finalize

protected void finalize()
                 throws Throwable
Close the index automatically.

Overrides:
finalize in class Object
Throws:
Throwable


Copyright ©2007-2013 panFMP Developers c/o Uwe Schindler