public abstract class LockFactory extends Object
Base class for Locking implementation. Directory
uses
instances of this class to implement locking.
Lucene uses NativeFSLockFactory
by default for
FSDirectory
-based index directories.
Special care needs to be taken if you change the locking implementation: First be certain that no writer is in fact writing to the index otherwise you can easily corrupt your index. Be sure to do the LockFactory change on all Lucene instances and clean up all leftover lock files before starting the new configuration for the first time. Different implementations can not work together!
If you suspect that some LockFactory implementation is
not working properly in your environment, you can easily
test it by using VerifyingLockFactory
, LockVerifyServer
and LockStressTest
.
LockVerifyServer
,
LockStressTest
,
VerifyingLockFactory
Modifier and Type | Field and Description |
---|---|
protected String |
lockPrefix |
Constructor and Description |
---|
LockFactory() |
Modifier and Type | Method and Description |
---|---|
abstract void |
clearLock(String lockName)
Attempt to clear (forcefully unlock and remove) the
specified lock.
|
String |
getLockPrefix()
Get the prefix in use for all locks created in this LockFactory.
|
abstract Lock |
makeLock(String lockName)
Return a new Lock instance identified by lockName.
|
void |
setLockPrefix(String lockPrefix)
Set the prefix in use for all locks created in this
LockFactory.
|
protected String lockPrefix
public void setLockPrefix(String lockPrefix)
public String getLockPrefix()
public abstract Lock makeLock(String lockName)
lockName
- name of the lock to be created.public abstract void clearLock(String lockName) throws IOException
lockName
- name of the lock to be cleared.IOException
Copyright © 2000-2014 Apache Software Foundation. All Rights Reserved.