org.apache.lucene.store
public class NativeFSLockFactory extends LockFactory
The advantage of this lock factory over SimpleFSLockFactory is that the locks should be "correct", whereas SimpleFSLockFactory uses java.io.File.createNewFile which has warnings about not using it for locking. Furthermore, if the JVM crashes, the OS will free any held locks, whereas SimpleFSLockFactory will keep the locks held, requiring manual removal before re-running Lucene.
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.
See Also: LockFactory
Constructor Summary | |
---|---|
NativeFSLockFactory(String lockDirName)
Create a NativeFSLockFactory instance, storing lock
files into the specified lockDirName:
| |
NativeFSLockFactory(File lockDir)
Create a NativeFSLockFactory instance, storing lock
files into the specified lockDir:
|
Method Summary | |
---|---|
void | clearLock(String lockName) |
Lock | makeLock(String lockName) |
Parameters: lockDirName where lock files are created.
Parameters: lockDir where lock files are created.