You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Britton, Colin" <cb...@metatomix.com> on 2002/02/08 19:43:24 UTC
Patch for IndexReader
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*****
Re: Patch for IndexReader
Posted by Otis Gospodnetic <ot...@yahoo.com>.
Aloha,
public static boolean isLocked(Directory directory) already exists, so
I'll leave that as is.
Thanks,
Otis
--- "Britton, Colin" <cb...@metatomix.com> wrote:
> 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*****
>
> ATTACHMENT part 2 application/octet-stream name=lucene_patch.diff
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail
http://mail.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Patch for IndexReader
Posted by Otis Gospodnetic <ot...@yahoo.com>.
This addition looks fine to me - the isLocked(Directory) method already
exists in IndexReader, so this is good for completion.
I will commit this tomorrow morning unless somebody sends me an email
by then with arguments against this patch.
Thanks,
Otis
--- "Britton, Colin" <cb...@metatomix.com> wrote:
> 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*****
>
> ATTACHMENT part 2 application/octet-stream name=lucene_patch.diff
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail
http://mail.yahoo.com
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>