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:
CompoundFileDirectory,FileSwitchDirectory,FSDirectory,RAMDirectory
public abstract class BaseDirectory extends Directory
Base implementation for a concreteDirectory.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.apache.lucene.store.Directory
Directory.IndexInputSlicer
-
-
Field Summary
Fields Modifier and Type Field Description protected booleanisOpenprotected LockFactorylockFactoryHolds the LockFactory instance (implements locking for this Directory instance).
-
Constructor Summary
Constructors Modifier Constructor Description protectedBaseDirectory()Sole constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclearLock(String name)Attempt to clear (forcefully unlock and remove) the specified lock.protected voidensureOpen()LockFactorygetLockFactory()Get the LockFactory that this Directory instance is using for its locking implementation.LockmakeLock(String name)Construct aLock.voidsetLockFactory(LockFactory lockFactory)Set the LockFactory that this Directory instance should use for its locking implementation.-
Methods inherited from class org.apache.lucene.store.Directory
close, copy, createOutput, createSlicer, deleteFile, fileExists, fileLength, getLockID, listAll, openInput, sync, toString
-
-
-
-
Field Detail
-
isOpen
protected volatile boolean isOpen
-
lockFactory
protected LockFactory lockFactory
Holds the LockFactory instance (implements locking for this Directory instance).
-
-
Method Detail
-
makeLock
public Lock makeLock(String name)
Description copied from class:DirectoryConstruct aLock.
-
clearLock
public void clearLock(String name) throws IOException
Description copied from class:DirectoryAttempt to clear (forcefully unlock and remove) the specified lock. Only call this at a time when you are certain this lock is no longer in use.- Specified by:
clearLockin classDirectory- Parameters:
name- name of the lock to be cleared.- Throws:
IOException
-
setLockFactory
public void setLockFactory(LockFactory lockFactory) throws IOException
Description copied from class:DirectorySet the LockFactory that this Directory instance should use for its locking implementation. Each * instance of LockFactory should only be used for one directory (ie, do not share a single instance across multiple Directories).- Specified by:
setLockFactoryin classDirectory- Parameters:
lockFactory- instance ofLockFactory.- Throws:
IOException
-
getLockFactory
public LockFactory getLockFactory()
Description copied from class:DirectoryGet the LockFactory that this Directory instance is using for its locking implementation. Note that this may be null for Directory implementations that provide their own locking implementation.- Specified by:
getLockFactoryin classDirectory
-
ensureOpen
protected final void ensureOpen() throws AlreadyClosedException- Overrides:
ensureOpenin classDirectory- Throws:
AlreadyClosedException- if this Directory is closed
-
-