Index: src/java/org/apache/lucene/store/MMapDirectory.java =================================================================== --- src/java/org/apache/lucene/store/MMapDirectory.java (revision 988223) +++ src/java/org/apache/lucene/store/MMapDirectory.java (working copy) @@ -68,6 +68,13 @@ * an undocumented internal cleanup functionality. * {@link #UNMAP_SUPPORTED} is true, if the workaround * can be enabled (with no guarantees). + *

+ * NOTE: Accessing this class either directly or + * indirectly from a thread while it's interrupted can close the + * underlying channel immediately if at the same time the thread is + * blocked on IO. The channel will remain closed and subsequent access + * to {@link MMapDirectory} will throw a {@link ClosedChannelException}. + *

*/ public class MMapDirectory extends FSDirectory { private boolean useUnmapHack = false; Index: src/java/org/apache/lucene/store/NIOFSDirectory.java =================================================================== --- src/java/org/apache/lucene/store/NIOFSDirectory.java (revision 988223) +++ src/java/org/apache/lucene/store/NIOFSDirectory.java (working copy) @@ -21,22 +21,32 @@ import java.io.IOException; import java.nio.ByteBuffer; import java.nio.channels.FileChannel; +import java.util.concurrent.Future; // javadoc /** - * An {@link FSDirectory} implementation that uses - * java.nio's FileChannel's positional read, which allows - * multiple threads to read from the same file without - * synchronizing. - * - *

This class only uses FileChannel when reading; writing - * is achieved with {@link FSDirectory.FSIndexOutput}. - * - *

NOTE: NIOFSDirectory is not recommended on Windows because of a bug - * in how FileChannel.read is implemented in Sun's JRE. - * Inside of the implementation the position is apparently - * synchronized. See + * This class only uses FileChannel when reading; writing is achieved with + * {@link SimpleFSDirectory.SimpleFSIndexOutput}. + *

+ * NOTE: NIOFSDirectory is not recommended on Windows because of a bug in + * how FileChannel.read is implemented in Sun's JRE. Inside of the + * implementation the position is apparently synchronized. See here * for details. + *

+ *

+ * NOTE: Accessing this class either directly or + * indirectly from a thread while it's interrupted can close the + * underlying file descriptor immediately if at the same time the thread is + * blocked on IO. The file descriptor will remain closed and subsequent access + * to {@link NIOFSDirectory} will throw a {@link ClosedChannelException}. If + * your application uses either {@link Thread#interrupt()} or + * {@link Future#cancel(boolean)} you should use {@link SimpleFSDirectory} in + * favor of {@link NIOFSDirectory}. + *

*/ public class NIOFSDirectory extends FSDirectory {