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
| Improve this Doc View Sourcem_lockPrefix
Declaration
protected string m_lockPrefix
Field Value
Type | Description |
---|---|
System.String |
Properties
| Improve this Doc View SourceLockPrefix
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 |
---|---|
System.String |
Methods
| Improve this Doc View SourceClearLock(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 |
---|---|---|
System.String | lockName | name of the lock to be cleared. |
MakeLock(String)
Return a new Lock instance identified by lockName
.
Declaration
public abstract Lock MakeLock(string lockName)
Parameters
Type | Name | Description |
---|---|---|
System.String | lockName | name of the lock to be created. |
Returns
Type | Description |
---|---|
Lock |