org.hibernate.search.indexes.impl

## Class PeriodicRefreshingReaderProvider.ReaderUsagePair

- java.lang.Object
- - org.hibernate.search.indexes.impl.PeriodicRefreshingReaderProvider.ReaderUsagePair

- Enclosing class:
    PeriodicRefreshingReaderProvider

      protected final class PeriodicRefreshingReaderProvider.ReaderUsagePair
      extends Object

  Container for the couple IndexReader,UsageCounter.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `DirectoryReader` | `reader`
    `protected AtomicInteger` | `usageCounter` When reaching 0 (always test on change) the reader should be really closed and then discarded.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes the `IndexReader` if no other resource is using it in which case the reference to this container will also be removed.
    `String` | `toString()`

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

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

- - ### Field Detail

    - #### reader

          public final DirectoryReader reader

    - #### usageCounter

          protected final AtomicInteger usageCounter

      When reaching 0 (always test on change) the reader should be really closed and then discarded. Starts at 2 because: first usage token is artificial: means "current" is not to be closed (+1) additionally when creating it will be used (+1)

  - ### Method Detail

    - #### close

          public void close()

      Closes the `IndexReader` if no other resource is using it in which case the reference to this container will also be removed.

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved