org.hibernate.search.indexes.impl

## Class SharingBufferReaderProvider

- java.lang.Object
- - org.hibernate.search.indexes.impl.SharingBufferReaderProvider

- All Implemented Interfaces:
    DirectoryBasedReaderProvider, ReaderProvider

      public class SharingBufferReaderProvider
      extends Object
      implements DirectoryBasedReaderProvider

  This `ReaderProvider` shares IndexReaders as long as they are "current"; It uses IndexReader.reopen() which should improve performance on larger indexes as it shares buffers with previous IndexReader generation for the segments which didn't change.
  Author:
    Sanne Grinovero (C) 2011 Red Hat Inc.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `protected class` | `SharingBufferReaderProvider.PerDirectoryLatestReader` An instance for each DirectoryProvider, establishing the association between "current" ReaderUsagePair for a DirectoryProvider and it's lock.
    `protected class` | `SharingBufferReaderProvider.ReaderUsagePair` Container for the couple IndexReader,UsageCounter.

  - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected Map<IndexReader,SharingBufferReaderProvider.ReaderUsagePair>` | `allReaders` contains all Readers (most current per Directory and all unclosed old readers)
    `protected Map<Directory,SharingBufferReaderProvider.PerDirectoryLatestReader>` | `currentReaders` contains last updated Reader; protected by lockOnOpenLatest (in the values)

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SharingBufferReaderProvider()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `closeIndexReader(IndexReader reader)`
    `void` | `initialize(DirectoryBasedIndexManager indexManager, Properties props)`
    `DirectoryReader` | `openIndexReader()`
    `protected DirectoryReader` | `readerFactory(Directory directory)`
    `void` | `stop()`

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

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

- - ### Field Detail

    - #### allReaders

          protected final Map<IndexReader,SharingBufferReaderProvider.ReaderUsagePair> allReaders

      contains all Readers (most current per Directory and all unclosed old readers)

    - #### currentReaders

          protected final Map<Directory,SharingBufferReaderProvider.PerDirectoryLatestReader> currentReaders

      contains last updated Reader; protected by lockOnOpenLatest (in the values)

  - ### Constructor Detail

    - #### SharingBufferReaderProvider

          public SharingBufferReaderProvider()

  - ### Method Detail

    - #### openIndexReader

          public DirectoryReader openIndexReader()

      Specified by:
        `openIndexReader` in interface `ReaderProvider`

    - #### closeIndexReader

          public void closeIndexReader(IndexReader reader)

      Specified by:
        `closeIndexReader` in interface `ReaderProvider`

    - #### initialize

          public void initialize(DirectoryBasedIndexManager indexManager,
                                 Properties props)

      Specified by:
        `initialize` in interface `DirectoryBasedReaderProvider`

    - #### stop

          public void stop()

      Specified by:
        `stop` in interface `DirectoryBasedReaderProvider`

    - #### readerFactory

          protected DirectoryReader readerFactory(Directory directory)
                                           throws IOException

      Throws:
        `IOException`

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