You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Donovan, Aaron" <do...@bah.com> on 2007/01/23 15:28:33 UTC

LockFactory impact on Directory implementations

In anticipation of an upcoming 2.1 release, I started testing the
Berkeley Database - Java Edition Directory implementation.  I
immediately received a NullPointerException while trying to create an
index.  It was a result of the getLockFactory() returning null.
 
What is the new responsibility of Directory implementations regarding a
LockFactory?
 
Should Directory return a donothing implementation by default? 
 - Both of the Berkeley implementations would benefit from this approach
because the database handles locks.
 
Regards,
Aaron Donovan
 

Re: LockFactory impact on Directory implementations

Posted by Michael McCandless <lu...@mikemccandless.com>.
Donovan, Aaron wrote:
> In anticipation of an upcoming 2.1 release, I started testing the
> Berkeley Database - Java Edition Directory implementation.  I
> immediately received a NullPointerException while trying to create an
> index.  It was a result of the getLockFactory() returning null.
>  
> What is the new responsibility of Directory implementations regarding a
> LockFactory?
>  
> Should Directory return a donothing implementation by default? 
>  - Both of the Berkeley implementations would benefit from this approach
> because the database handles locks.

Hmmm... the LockFactory implementation is supposed to be backwards
compatible to Directory implementations that define their own
makeLock(...) method.

In other words, subclasses of Directory should not need to use a
LockFactory at all if they want to continue to implement their own
locking instead.

Oh, I think I see what happened.  Are you hitting NPE on this line in
IndexWriter?:

     if (create) {
       // Clear the write lock in case it's leftover:
       directory.getLockFactory().clearLock(IndexWriter.WRITE_LOCK_NAME);
     }

This is my bad ... sorry about that.  This was part of my recent fix
for LUCENE-773.  I will re-open that issue, add a unit test, and fix
this case.  Thanks for catching it!

Mike

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org