org.apache.lucene.store
Class NIOFSDirectory
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.store.FSDirectory
org.apache.lucene.store.NIOFSDirectory
public class NIOFSDirectory
- extends FSDirectory
NIO version of FSDirectory. Uses FileChannel.read(ByteBuffer dst, long position) method
which allows multiple threads to read from the file without synchronizing. FSDirectory
synchronizes in the FSIndexInput.readInternal method which can cause pileups when there
are many threads accessing the Directory concurrently.
This class only uses FileChannel when reading; writing
with an IndexOutput is inherited from FSDirectory.
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:
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6265734
- See Also:
FSDirectory
Method Summary |
IndexInput |
openInput(String name,
int bufferSize)
Returns a stream reading an existing file, with the
specified read buffer size. |
Methods inherited from class org.apache.lucene.store.FSDirectory |
close, createOutput, deleteFile, fileExists, fileLength, fileModified, fileModified, getDirectory, getDirectory, getDirectory, getDirectory, getDirectory, getDirectory, getDisableLocks, getFile, getLockID, list, openInput, renameFile, setDisableLocks, sync, toString, touchFile |
NIOFSDirectory
public NIOFSDirectory()
openInput
public IndexInput openInput(String name,
int bufferSize)
throws IOException
- Description copied from class:
Directory
- Returns a stream reading an existing file, with the
specified read buffer size. The particular Directory
implementation may ignore the buffer size. Currently
the only Directory implementations that respect this
parameter are
FSDirectory
and CompoundFileReader
.
- Overrides:
openInput
in class FSDirectory
- Throws:
IOException
Copyright © 2000-2008 Apache Software Foundation. All Rights Reserved.