Class AbstractReaderMonitor


  • public abstract class AbstractReaderMonitor
    extends java.lang.Object
    ReaderMonitor holds IndexReader and IndexSearcher. When ReaderMonitor is closed it do not close IndexReader and IndexSearcher as long as someone reads from them. Variable readingCount remember how many times it was read.
    • Field Detail

      • readingCount

        private final java.util.concurrent.atomic.AtomicInteger readingCount
      • doClose

        private final java.util.concurrent.atomic.AtomicBoolean doClose
      • closed

        private final java.util.concurrent.atomic.AtomicBoolean closed
    • Constructor Detail

    • Method Detail

      • getReadingCount

        public final int getReadingCount()
      • beginReading

        public final void beginReading()
      • endReading

        public final void endReading()
                              throws java.io.IOException
        called by the iterator
        Throws:
        java.io.IOException
      • closeWhenPossible

        public final boolean closeWhenPossible()
                                        throws java.io.IOException
        This method is called in LecenIndex invalidateReaders or on commit
        Returns:
        true if the close succeeded, false otherwise.
        Throws:
        java.io.IOException
      • close

        public final void close()
                         throws java.io.IOException
        Throws:
        java.io.IOException
      • handleClose

        protected abstract void handleClose()
                                     throws java.io.IOException
        This method is thread-safe (i.e. it is not called concurrently).
        Throws:
        java.io.IOException