Mailing List Archive

cvs commit: jakarta-lucene/src/java/org/apache/lucene/index IndexReader.java
otis 02/02/15 10:59:42

Modified: src/java/org/apache/lucene/index IndexReader.java
Log:
- Added public static boolean isLocked(String) method.
Submitted by: Colin Britton
Reviewed by: otis

Revision Changes Path
1.9 +10 -0 jakarta-lucene/src/java/org/apache/lucene/index/IndexReader.java

Index: IndexReader.java
===================================================================
RCS file: /home/cvs/jakarta-lucene/src/java/org/apache/lucene/index/IndexReader.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- IndexReader.java 14 Feb 2002 00:58:46 -0000 1.8
+++ IndexReader.java 15 Feb 2002 18:59:42 -0000 1.9
@@ -310,6 +310,16 @@
return directory.fileExists("write.lock");
}

+ /**
+ * Returns <code>true</code> iff the index in the named directory is
+ * currently locked.
+ * @param directory the directory to check for a lock
+ * @throws IOException if there is a problem with accessing the index
+ */
+ public static boolean isLocked(String directory) throws IOException {
+ return (new File(directory, "write.lock")).exists();
+ }
+
/**
* Forcibly unlocks the index in the named directory.
* <P>




--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>