C# Class Lucene.Net.Store.NativeFSLockFactory

Implements {@link LockFactory} using native OS file locks. Note that because this LockFactory relies on java.nio.* APIs for locking, any problems with those APIs will cause locking to fail. Specifically, on certain NFS environments the java.nio.* locks will fail (the lock can incorrectly be double acquired) whereas {@link SimpleFSLockFactory} worked perfectly in those same environments. For NFS based access to an index, it's recommended that you try {@link SimpleFSLockFactory} first and work around the one limitation that a lock file could be left when the JVM exits abnormally.

The primary benefit of {@link NativeFSLockFactory} is that lock files will be properly removed (by the OS) if the JVM has an abnormal exit.

Note that, unlike {@link SimpleFSLockFactory}, the existence of leftover lock files in the filesystem on exiting the JVM is fine because the OS will free the locks held against these files even though the files still remain.

If you suspect that this or any other LockFactory is not working properly in your environment, you can easily test it by using {@link VerifyingLockFactory}, {@link LockVerifyServer} and {@link LockStressTest}.

Inheritance: Lucene.Net.Store.FSLockFactory
Exibir arquivo Open project: apache/lucenenet Class Usage Examples

Public Methods

Method Description
ClearLock ( string lockName ) : void
MakeLock ( string lockName ) : Lock
NativeFSLockFactory ( ) : System

Create a NativeFSLockFactory instance, with null (unset) lock directory. When you pass this factory to a FSDirectory subclass, the lock directory is automatically set to the directory itself. Be sure to create one instance for each directory your create!

NativeFSLockFactory ( DirectoryInfo lockDir ) : System

Create a NativeFSLockFactory instance, storing lock files into the specified lockDir:

NativeFSLockFactory ( string lockDirName ) : System

Create a NativeFSLockFactory instance, storing lock files into the specified lockDirName:

Method Details

ClearLock() public method

public ClearLock ( string lockName ) : void
lockName string
return void

MakeLock() public method

public MakeLock ( string lockName ) : Lock
lockName string
return Lock

NativeFSLockFactory() public method

Create a NativeFSLockFactory instance, with null (unset) lock directory. When you pass this factory to a FSDirectory subclass, the lock directory is automatically set to the directory itself. Be sure to create one instance for each directory your create!
public NativeFSLockFactory ( ) : System
return System

NativeFSLockFactory() public method

Create a NativeFSLockFactory instance, storing lock files into the specified lockDir:
public NativeFSLockFactory ( DirectoryInfo lockDir ) : System
lockDir DirectoryInfo where lock files are created.
return System

NativeFSLockFactory() public method

Create a NativeFSLockFactory instance, storing lock files into the specified lockDirName:
public NativeFSLockFactory ( string lockDirName ) : System
lockDirName string where lock files are created.
return System