mirror of https://github.com/apache/lucene.git
We can just use Lock.toString() to show lock file, no?
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150326 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
8c43a92da9
commit
9ed56d3d04
|
@ -290,7 +290,7 @@ public final class FSDirectory extends Directory {
|
|||
// create a lock file
|
||||
final File lockFile = new File(lockDir, buf.toString());
|
||||
|
||||
return new Lock(lockFile.getAbsolutePath()) {
|
||||
return new Lock() {
|
||||
public boolean obtain() throws IOException {
|
||||
if (DISABLE_LOCKS)
|
||||
return true;
|
||||
|
|
|
@ -35,15 +35,7 @@ import java.io.IOException;
|
|||
*/
|
||||
public abstract class Lock {
|
||||
public static long LOCK_POLL_INTERVAL = 1000;
|
||||
private String lockName = null;
|
||||
|
||||
public Lock(String lockName) {
|
||||
this.lockName = lockName;
|
||||
}
|
||||
|
||||
public Lock() {
|
||||
}
|
||||
|
||||
/** Attempts to obtain exclusive access and immediately return
|
||||
* upon success or failure.
|
||||
* @return true iff exclusive access is obtained
|
||||
|
@ -63,11 +55,7 @@ public abstract class Lock {
|
|||
int sleepCount = 0;
|
||||
while (!locked) {
|
||||
if (++sleepCount == maxSleepCount) {
|
||||
String s = "Lock obtain timed out";
|
||||
if (lockName != null) {
|
||||
s += ", lock name =" + lockName;
|
||||
}
|
||||
throw new IOException(s);
|
||||
throw new IOException("Lock obtain timed out: " + this.toString());
|
||||
}
|
||||
try {
|
||||
Thread.sleep(LOCK_POLL_INTERVAL);
|
||||
|
|
Loading…
Reference in New Issue