org.apache.lucene.index

## Interface LeafReader.CoreClosedListener

- Enclosing class:
    LeafReader

      public static interface LeafReader.CoreClosedListener

  Called when the shared core for this `LeafReader` is closed.

  If this `LeafReader` impl has the ability to share resources across instances that might only vary through deleted documents and doc values updates, then this listener will only be called when the shared core is closed. Otherwise, this listener will be called when this reader is closed.

  This is typically useful to manage per-segment caches: when the listener is called, it is safe to evict this reader from any caches keyed on `IndexReader.getCoreCacheKey()`.

  WARNING: This API is experimental and might change in incompatible ways in the next release.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `onClose(Object ownerCoreCacheKey)` Invoked when the shared core of the original `SegmentReader` has closed.

- - ### Method Detail

    - #### onClose

          void onClose(Object ownerCoreCacheKey)
                throws IOException

      Invoked when the shared core of the original `SegmentReader` has closed. The provided `ownerCoreCacheKey` will be the same key as the one returned by `IndexReader.getCoreCacheKey()`.
      Throws:
        `IOException`

Copyright © 2000-2019 Apache Software Foundation. All Rights Reserved.