Package org.eclipse.rdf4j.sail.lucene

## Class AbstractReaderMonitor

- java.lang.Object
- - org.eclipse.rdf4j.sail.lucene.AbstractReaderMonitor

- Direct Known Subclasses:
    `ReaderMonitor`

      public abstract class AbstractReaderMonitor
      extends 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.
  Author:
    Tomasz Trela, DFKI Gmbh

- - ### Constructor Summary

    Constructors
    Modifier | Constructor | Description
    --- | --- | ---
    `protected` | `AbstractReaderMonitor​(AbstractLuceneIndex index)` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `beginReading()` |
    `void` | `close()` |
    `boolean` | `closeWhenPossible()` | This method is called in LecenIndex invalidateReaders or on commit
    `void` | `endReading()` | called by the iterator
    `int` | `getReadingCount()` |
    `protected abstract void` | `handleClose()` | This method is thread-safe (i.e.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AbstractReaderMonitor

          protected AbstractReaderMonitor​(AbstractLuceneIndex index)

  - ### Method Detail

    - #### getReadingCount

          public final int getReadingCount()

    - #### beginReading

          public final void beginReading()

    - #### endReading

          public final void endReading()
                                throws IOException

      called by the iterator
      Throws:
        `IOException`

    - #### closeWhenPossible

          public final boolean closeWhenPossible()
                                          throws IOException

      This method is called in LecenIndex invalidateReaders or on commit
      Returns:
        `true` if the close succeeded, `false` otherwise.
      Throws:
        `IOException`

    - #### close

          public final void close()
                           throws IOException

      Throws:
        `IOException`

    - #### handleClose

          protected abstract void handleClose()
                                       throws IOException

      This method is thread-safe (i.e. it is not called concurrently).
      Throws:
        `IOException`