public class NativeFSLockFactory extends FSLockFactory
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
SimpleFSLockFactory worked perfectly in those same
environments. For NFS based access to an index, it's
recommended that you try
first and work around the one limitation that a lock file
could be left when the JVM exits abnormally.
The primary benefit of
that lock files will be properly removed (by the OS) if
the JVM has an abnormal exit.
Note that, unlike
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.
|Constructor and Description|
Create a NativeFSLockFactory instance, with null (unset) lock directory.
Create a NativeFSLockFactory instance, storing lock files into the specified lockDir:
Create a NativeFSLockFactory instance, storing lock files into the specified lockDirName:
|Modifier and Type||Method and Description|
Attempt to clear (forcefully unlock and remove) the specified lock.
Return a new Lock instance identified by lockName.
FSDirectorysubclass, the lock directory is automatically set to the directory itself. Be sure to create one instance for each directory your create!
public NativeFSLockFactory(String lockDirName)
lockDirName- where lock files are created.
public NativeFSLockFactory(File lockDir)
lockDir- where lock files are created.
public void clearLock(String lockName) throws IOException
Copyright © 2000-2013 Apache Software Foundation. All Rights Reserved.