[ 
https://issues.apache.org/jira/browse/LUCENE-5953?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14137993#comment-14137993
 ] 

Uwe Schindler commented on LUCENE-5953:
---------------------------------------

clearLock() in directory and lockfactory is obsolete, too. It was previously 
used to release any possible locks, but it is never used by any code in Lucene. 
To release a lock, you have to call release() on the lock itsself. This was a 
nice cleanup.

My proposal:
LockFactory only has one method: makeLock(Directory, lockName). By that we dont 
need to pass the directory path. If a lock factory needs the directory it can 
use it, if not (singleinstance or nolock) it just ignores (or maybe it can use 
it to key against directory instance - SingleInstanceLockFactory would be 
easier to implement).

The directory keeps as it is, it just passes "this" to the lock factory (on 
lowest level, so FilterDirectory wont do this).

This also removes instanceof checks, because FSLockFactory would simply deny to 
work together with RAMDirectory.

I will post a patch for review later or tomorrow - this is just a collection of 
my ideas...

> Make LockFactory final on Directory
> -----------------------------------
>
>                 Key: LUCENE-5953
>                 URL: https://issues.apache.org/jira/browse/LUCENE-5953
>             Project: Lucene - Core
>          Issue Type: Improvement
>          Components: core/store
>            Reporter: Uwe Schindler
>            Assignee: Uwe Schindler
>             Fix For: 5.0
>
>
> We should remove the setters for the LockFactory from Directory and make the 
> field final. It is a bug to change the LockFactory after creating a 
> directory, because you may break locking (if locks are currently held).
> The LockFactory should be passed on ctor only.
> The other suggestion: Should LockFactory have a directory at all? We moved 
> away from having the lock separately from the index directory. This is no 
> longer a supported configuration (since approx Lucene 2.9 or 3.0). I would 
> like to remove the directory from LockFactory and make it part of the 
> Directory only.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to