public final class SingleInstanceLockFactory extends LockFactory
LockFactory
for a single in-process instance,
meaning all locking will take place through this one instance.
Only use this LockFactory
when you are certain all
IndexWriters for a given index are running
against a single shared in-process Directory instance. This is
currently the default locking for RAMDirectory.LockFactory
Modifier and Type | Class and Description |
---|---|
private class |
SingleInstanceLockFactory.SingleInstanceLock |
Modifier and Type | Field and Description |
---|---|
(package private) java.util.HashSet<java.lang.String> |
locks |
Constructor and Description |
---|
SingleInstanceLockFactory() |
Modifier and Type | Method and Description |
---|---|
Lock |
obtainLock(Directory dir,
java.lang.String lockName)
Return a new obtained Lock instance identified by lockName.
|
public Lock obtainLock(Directory dir, java.lang.String lockName) throws java.io.IOException
LockFactory
obtainLock
in class LockFactory
lockName
- name of the lock to be created.LockObtainFailedException
- (optional specific exception) if the lock could
not be obtained because it is currently held elsewhere.java.io.IOException
- if any i/o error occurs attempting to gain the lock