Class LockFactory
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.
Inheritance
Inherited Members
Namespace: Lucene.Net.Store
Assembly: Lucene.Net.dll
Syntax
public abstract class LockFactory
Fields
m_lockPrefix
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.
Declaration
protected string m_lockPrefix
Field Value
Type | Description |
---|---|
string |
See Also
Properties
LockPrefix
Gets or Sets the prefix in use for all locks created in this LockFactory. This is normally called once, when a Directory gets this LockFactory instance. However, you can also call this (after this instance is assigned to a Directory) to override the prefix in use. This is helpful if you're running Lucene on machines that have different mount points for the same shared directory.
Declaration
public virtual string LockPrefix { get; set; }
Property Value
Type | Description |
---|---|
string |
See Also
Methods
ClearLock(string)
Attempt 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.
Declaration
public abstract void ClearLock(string lockName)
Parameters
Type | Name | Description |
---|---|---|
string | lockName | name of the lock to be cleared. |
See Also
MakeLock(string)
Return a new Lock instance identified by lockName
.
Declaration
public abstract Lock MakeLock(string lockName)
Parameters
Type | Name | Description |
---|---|---|
string | lockName | name of the lock to be created. |
Returns
Type | Description |
---|---|
Lock |