Package org.apache.lucene.store
Class BaseDirectory
java.lang.Object
org.apache.lucene.store.Directory
org.apache.lucene.store.BaseDirectory
- All Implemented Interfaces:
Closeable
,AutoCloseable
- Direct Known Subclasses:
ByteBuffersDirectory
,FSDirectory
Base implementation for a concrete
Directory
that uses a LockFactory
for locking.- WARNING: This API is experimental and might change in incompatible ways in the next release.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected boolean
protected final LockFactory
Holds the LockFactory instance (implements locking for this Directory instance). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
Ensures this directory is still open.final Lock
obtainLock
(String name) Acquires and returns aLock
for a file with the given name.toString()
Methods inherited from class org.apache.lucene.store.Directory
close, copyFrom, createOutput, createTempOutput, deleteFile, fileLength, getPendingDeletions, getTempFileName, listAll, openChecksumInput, openInput, rename, sync, syncMetaData
-
Field Details
-
isOpen
protected volatile boolean isOpen -
lockFactory
Holds the LockFactory instance (implements locking for this Directory instance).
-
-
Constructor Details
-
BaseDirectory
Sole constructor.
-
-
Method Details
-
obtainLock
Description copied from class:Directory
Acquires and returns aLock
for a file with the given name.- Specified by:
obtainLock
in classDirectory
- Parameters:
name
- the name of the lock file- Throws:
LockObtainFailedException
- (optional specific exception) if the lock could not be obtained because it is currently held elsewhere.IOException
- if any i/o error occurs attempting to gain the lock
-
ensureOpen
Description copied from class:Directory
Ensures this directory is still open.- Overrides:
ensureOpen
in classDirectory
- Throws:
AlreadyClosedException
- if this directory is closed.
-
toString
-