Class SimpleFSDirectory

All Implemented Interfaces:
Closeable, AutoCloseable

public class SimpleFSDirectory extends FSDirectory
Deprecated.
This class is a less efficient implementation of what's available in NIOFSDirectory, and will be removed in future versions of Lucene.
A straightforward implementation of FSDirectory using Files.newByteChannel(Path, java.nio.file.OpenOption...). However, this class has poor concurrent performance (multiple threads will bottleneck) as it synchronizes when multiple threads read from the same file. It's usually better to use NIOFSDirectory or MMapDirectory instead.

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 SimpleFSDirectory will throw a ClosedChannelException. If your application uses either Thread.interrupt() or Future.cancel(boolean) you should use the legacy RAFDirectory from the Lucene misc module in favor of SimpleFSDirectory.

  • Constructor Details

    • SimpleFSDirectory

      public SimpleFSDirectory(Path path, LockFactory lockFactory) throws IOException
      Deprecated.
      Create a new SimpleFSDirectory for the named location. The directory is created at the named location if it does not yet exist.
      Parameters:
      path - the path of the directory
      lockFactory - the lock factory to use
      Throws:
      IOException - if there is a low-level I/O error
    • SimpleFSDirectory

      public SimpleFSDirectory(Path path) throws IOException
      Deprecated.
      Create a new SimpleFSDirectory for the named location and FSLockFactory.getDefault(). The directory is created at the named location if it does not yet exist.
      Parameters:
      path - the path of the directory
      Throws:
      IOException - if there is a low-level I/O error
  • Method Details