Package org.apache.lucene.store
Class SimpleFSDirectory
- java.lang.Object
-
- org.apache.lucene.store.Directory
-
- org.apache.lucene.store.BaseDirectory
-
- org.apache.lucene.store.FSDirectory
-
- org.apache.lucene.store.SimpleFSDirectory
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
public class SimpleFSDirectory extends FSDirectory
Deprecated.This class is a less efficient implementation of what's available inNIOFSDirectory
, and will be removed in future versions of Lucene.A straightforward implementation ofFSDirectory
usingFiles.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 useNIOFSDirectory
orMMapDirectory
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 aClosedChannelException
. If your application uses eitherThread.interrupt()
orFuture.cancel(boolean)
you should use the legacyRAFDirectory
from the Lucenemisc
module in favor ofSimpleFSDirectory
.
-
-
Field Summary
-
Fields inherited from class org.apache.lucene.store.FSDirectory
directory
-
Fields inherited from class org.apache.lucene.store.BaseDirectory
isOpen, lockFactory
-
-
Constructor Summary
Constructors Constructor Description SimpleFSDirectory(Path path)
Deprecated.Create a new SimpleFSDirectory for the named location andFSLockFactory.getDefault()
.SimpleFSDirectory(Path path, LockFactory lockFactory)
Deprecated.Create a new SimpleFSDirectory for the named location.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description IndexInput
openInput(String name, IOContext context)
Deprecated.Creates an IndexInput for the file with the given name.-
Methods inherited from class org.apache.lucene.store.FSDirectory
close, createOutput, createTempOutput, deleteFile, deletePendingFiles, ensureCanRead, fileLength, fsync, getDirectory, getPendingDeletions, listAll, listAll, open, open, rename, sync, syncMetaData, toString
-
Methods inherited from class org.apache.lucene.store.BaseDirectory
ensureOpen, obtainLock
-
Methods inherited from class org.apache.lucene.store.Directory
copyFrom, getTempFileName, openChecksumInput
-
-
-
-
Constructor Detail
-
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 directorylockFactory
- 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 andFSLockFactory.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 Detail
-
openInput
public IndexInput openInput(String name, IOContext context) throws IOException
Deprecated.Creates an IndexInput for the file with the given name.- Specified by:
openInput
in classDirectory
- Parameters:
name
- the name of an existing file.- Throws:
IOException
- in case of I/O error
-
-