Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

We can just use Lock.toString() to show lock file, no?

Doug Cutting9ed56d3d04ad
diff --git a/src/java/org/apache/lucene/store/FSDirectory.java b/src/java/org/apache/lucene/store/FSDirectory.java
index 3f56d88a5d5..8e0a2fe5d26 100644
--- a/src/java/org/apache/lucene/store/FSDirectory.java
+++ b/src/java/org/apache/lucene/store/FSDirectory.java
@@ -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;
diff --git a/src/java/org/apache/lucene/store/Lock.java b/src/java/org/apache/lucene/store/Lock.java
index fe31f3258fe..05dd7d29a09 100644
--- a/src/java/org/apache/lucene/store/Lock.java
+++ b/src/java/org/apache/lucene/store/Lock.java
@@ -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);