org.apache.lucene.index

## Class SegmentInfos.FindSegmentsFile

- java.lang.Object
- - org.apache.lucene.index.SegmentInfos.FindSegmentsFile

- Enclosing class:
    SegmentInfos

      public abstract static class SegmentInfos.FindSegmentsFile
      extends java.lang.Object

  Utility class for executing code that needs to do something with the current segments file. This is necessary with lock-less commits because from the time you locate the current segments file name, until you actually open it, read its contents, or check modified time, etc., it could have been deleted due to a writer commit finishing.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `FindSegmentsFile(Directory directory)`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract java.lang.Object` | `doBody(java.lang.String segmentFileName)` Subclass must implement this.
    `java.lang.Object` | `run()`
    `java.lang.Object` | `run(IndexCommit commit)`

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

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

- - ### Constructor Detail

    - #### FindSegmentsFile

          public FindSegmentsFile(Directory directory)

  - ### Method Detail

    - #### run

          public java.lang.Object run()
                               throws CorruptIndexException,
                                      java.io.IOException

      Throws:
        `CorruptIndexException`
        `java.io.IOException`

    - #### run

          public java.lang.Object run(IndexCommit commit)
                               throws CorruptIndexException,
                                      java.io.IOException

      Throws:
        `CorruptIndexException`
        `java.io.IOException`

    - #### doBody

          protected abstract java.lang.Object doBody(java.lang.String segmentFileName)
                                              throws CorruptIndexException,
                                                     java.io.IOException

      Subclass must implement this. The assumption is an IOException will be thrown if something goes wrong during the processing that could have been caused by a writer committing.
      Throws:
        `CorruptIndexException`
        `java.io.IOException`

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