mirror of https://github.com/apache/lucene.git
LUCENE-6225: Clarify documentation of clone/close in IndexInput.
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@1691892 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
b7c1b093dd
commit
fa6aef2f55
|
@ -20,19 +20,23 @@ package org.apache.lucene.store;
|
|||
import java.io.Closeable;
|
||||
import java.io.IOException;
|
||||
|
||||
/** Abstract base class for input from a file in a {@link Directory}. A
|
||||
/**
|
||||
* Abstract base class for input from a file in a {@link Directory}. A
|
||||
* random-access input stream. Used for all Lucene index input operations.
|
||||
*
|
||||
* <p>{@code IndexInput} may only be used from one thread, because it is not
|
||||
* thread safe (it keeps internal state like file position). To allow
|
||||
* multithreaded use, every {@code IndexInput} instance must be cloned before
|
||||
* used in another thread. Subclasses must therefore implement {@link #clone()},
|
||||
* it is used in another thread. Subclasses must therefore implement {@link #clone()},
|
||||
* returning a new {@code IndexInput} which operates on the same underlying
|
||||
* resource, but positioned independently. Lucene never closes cloned
|
||||
* {@code IndexInput}s, it will only do this on the original one.
|
||||
* The original instance must take care that cloned instances throw
|
||||
* {@link AlreadyClosedException} when the original one is closed.
|
||||
|
||||
* resource, but positioned independently.
|
||||
*
|
||||
* <p><b>Warning:</b> Lucene never closes cloned
|
||||
* {@code IndexInput}s, it will only call {@link #close()} on the original object.
|
||||
*
|
||||
* <p>If you access the cloned IndexInput after closing the original object,
|
||||
* any <code>readXXX</code> methods will throw {@link AlreadyClosedException}.
|
||||
*
|
||||
* @see Directory
|
||||
*/
|
||||
public abstract class IndexInput extends DataInput implements Cloneable,Closeable {
|
||||
|
@ -73,10 +77,12 @@ public abstract class IndexInput extends DataInput implements Cloneable,Closeabl
|
|||
}
|
||||
|
||||
/** {@inheritDoc}
|
||||
*
|
||||
* <p><b>Warning:</b> Lucene never closes cloned
|
||||
* {@code IndexInput}s, it will only do this on the original one.
|
||||
* The original instance must take care that cloned instances throw
|
||||
* {@link AlreadyClosedException} when the original one is closed.
|
||||
* {@code IndexInput}s, it will only call {@link #close()} on the original object.
|
||||
*
|
||||
* <p>If you access the cloned IndexInput after closing the original object,
|
||||
* any <code>readXXX</code> methods will throw {@link AlreadyClosedException}.
|
||||
*/
|
||||
@Override
|
||||
public IndexInput clone() {
|
||||
|
|
Loading…
Reference in New Issue