Here is a patch for IndexReader.isLocked() to support file and string in
the same way as IndexReader.indexExists()
It is in the body and as an attachment.
Rgds
CB
Index: IndexReader.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/IndexRea
der.java,v
retrieving revision 1.6
diff -u -r1.6 IndexReader.java
--- IndexReader.java 21 Jan 2002 17:07:23 -0000 1.6
+++ IndexReader.java 8 Feb 2002 18:40:03 -0000
@@ -269,7 +269,28 @@
*/
abstract public void close() throws IOException;
- /**
+ /**
+ * Returns <code>true</code> iff the index in the named directory is
+ * currently locked.
+ * @param String 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();
+ }
+
+ /**
+ * Returns <code>true</code> iff the index in the named directory is
+ * currently locked.
+ * @param File the directory to check for a lock
+ * @throws IOException if there is a problem with accessing the index
+ */
+ public static boolean isLocked(File directory) throws IOException {
+ return (new File(directory, "write.lock")).exists();
+ }
+
+
+ /**
* Returns <code>true</code> iff the index in the named directory is
* currently locked.
* @param directory the directory to check for a lock
*****CVS exited normally with code 1*****
the same way as IndexReader.indexExists()
It is in the body and as an attachment.
Rgds
CB
Index: IndexReader.java
===================================================================
RCS file:
/home/cvspublic/jakarta-lucene/src/java/org/apache/lucene/index/IndexRea
der.java,v
retrieving revision 1.6
diff -u -r1.6 IndexReader.java
--- IndexReader.java 21 Jan 2002 17:07:23 -0000 1.6
+++ IndexReader.java 8 Feb 2002 18:40:03 -0000
@@ -269,7 +269,28 @@
*/
abstract public void close() throws IOException;
- /**
+ /**
+ * Returns <code>true</code> iff the index in the named directory is
+ * currently locked.
+ * @param String 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();
+ }
+
+ /**
+ * Returns <code>true</code> iff the index in the named directory is
+ * currently locked.
+ * @param File the directory to check for a lock
+ * @throws IOException if there is a problem with accessing the index
+ */
+ public static boolean isLocked(File directory) throws IOException {
+ return (new File(directory, "write.lock")).exists();
+ }
+
+
+ /**
* Returns <code>true</code> iff the index in the named directory is
* currently locked.
* @param directory the directory to check for a lock
*****CVS exited normally with code 1*****