You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by ajay_garg <ga...@gmail.com> on 2008/01/31 07:40:22 UTC
A small doubt related to write.lock
Hi all.
I will be obliged, if someone could elaborate as to what is the difference
between IndexReader.unlock() and IndexWriter.finalize() methods.
Thanks
Ajay Garg
--
View this message in context: http://www.nabble.com/A-small-doubt-related-to-write.lock-tp15199037p15199037.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org
Re: A small doubt related to write.lock
Posted by Doron Cohen <cd...@gmail.com>.
Hi Ajay,
IndexReader.unlock() is a brute force call to be used by applications/users
knowing that a lock can be safely removed.
finalize() on the other hand is a method that Java will call when garbage
collecting a no-more-referenced object. So it is often a place for cleanup
code. However the problem with finalize is that it is not guaranteed when it
will be called, and in fact it is not guaranteed that it will be called at
all (even as the JVM shutsdown). Therefore it is not recommended to have
logic dependency in finalize(), and Lucene in fact does not have such, as
write locks are released elsewhere.
HTH,
Doron
On Thu, Jan 31, 2008 at 8:40 AM, ajay_garg <
garg.jeena.isi.ka.naam.hai@gmail.com> wrote:
>
> Hi all.
>
> I will be obliged, if someone could elaborate as to what is the difference
> between IndexReader.unlock() and IndexWriter.finalize() methods.
>
> Thanks
> Ajay Garg
> --
> View this message in context:
> http://www.nabble.com/A-small-doubt-related-to-write.lock-tp15199037p15199037.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>