From 7e5763e5ca7c02fc51214633283590000387547e Mon Sep 17 00:00:00 2001 From: Erik Hatcher Date: Mon, 10 May 2004 23:46:56 +0000 Subject: [PATCH] switch Lock to use a String instead of File git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@150321 13f79535-47bb-0310-9956-ffa450edef68 --- src/java/org/apache/lucene/store/FSDirectory.java | 2 +- src/java/org/apache/lucene/store/Lock.java | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/java/org/apache/lucene/store/FSDirectory.java b/src/java/org/apache/lucene/store/FSDirectory.java index 62bc2531abf..3f56d88a5d5 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) { + return new Lock(lockFile.getAbsolutePath()) { 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 00d1bea1034..fe31f3258fe 100644 --- a/src/java/org/apache/lucene/store/Lock.java +++ b/src/java/org/apache/lucene/store/Lock.java @@ -18,7 +18,6 @@ package org.apache.lucene.store; import org.apache.lucene.index.IndexWriter; -import java.io.File; import java.io.IOException; /** An interprocess mutex lock. @@ -36,10 +35,10 @@ import java.io.IOException; */ public abstract class Lock { public static long LOCK_POLL_INTERVAL = 1000; - private File lockFile = null; + private String lockName = null; - public Lock(File lockFile) { - this.lockFile = lockFile; + public Lock(String lockName) { + this.lockName = lockName; } public Lock() { @@ -65,8 +64,8 @@ public abstract class Lock { while (!locked) { if (++sleepCount == maxSleepCount) { String s = "Lock obtain timed out"; - if (lockFile != null) { - s += ", lock file =" + lockFile.getAbsolutePath(); + if (lockName != null) { + s += ", lock name =" + lockName; } throw new IOException(s); }