mirror of https://github.com/apache/lucene.git
LUCENE-2421: merge 3x to trunk
git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/trunk@961618 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
0d31aa07b3
commit
662059f219
|
@ -152,13 +152,20 @@ public class NativeFSLockFactory extends FSLockFactory {
|
|||
// they are locked, but, still do this in case people
|
||||
// really want to see the files go away:
|
||||
if (lockDir.exists()) {
|
||||
|
||||
// Try to release the lock first - if it's held by another process, this
|
||||
// method should not silently fail.
|
||||
// NOTE: makeLock fixes the lock name by prefixing it w/ lockPrefix.
|
||||
// Therefore it should be called before the code block next which prefixes
|
||||
// the given name.
|
||||
makeLock(lockName).release();
|
||||
|
||||
if (lockPrefix != null) {
|
||||
lockName = lockPrefix + "-" + lockName;
|
||||
}
|
||||
File lockFile = new File(lockDir, lockName);
|
||||
if (lockFile.exists() && !lockFile.delete()) {
|
||||
throw new IOException("Cannot delete " + lockFile);
|
||||
}
|
||||
|
||||
// As mentioned above, we don't care if the deletion of the file failed.
|
||||
new File(lockDir, lockName).delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue