Benjamin Reed commented on ZOOKEEPER-767:

1) just to make sure we are talking about the same thing. this is the code i'm 
referring to:

// Check that we don't already have a lock...
if (currentExclusiveLock != null && !isExpired(currentExclusiveLock)) {
           // We have the exclusive lock! Remove newly made lock file and just
           // return.
           zooKeeper.delete(writeLock, -1);
           return currentExclusiveLock;

2) no, i'm talking about when you go to get the shared lock, you first check to 
see if you have a shared lock. shouldn't you check for both shared and 

3) the problem is that connection loss and session expiration are different. 
with connection loss you will get an exception, but your session can recover 
and you can keep using it. for session expired you are right the EPHEMERAL will 
go away. in the connection loss scenario you have a situation where you may 
acquire a lock but not know it.

with regard to the question of current lock implementation in the repository. 
i'm trying to understand the differences with that implementation and yours. 
both follow the same recipe right? if the current lock implementation 
implemented shared locks, would you have used that one? or is there something 
more fundamental?

> Submitting Demo/Recipe Shared / Exclusive Lock Code
> ---------------------------------------------------
>                 Key: ZOOKEEPER-767
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-767
>             Project: Zookeeper
>          Issue Type: Improvement
>          Components: recipes
>    Affects Versions: 3.3.0
>            Reporter: Sam Baskinger
>            Assignee: Sam Baskinger
>            Priority: Minor
>             Fix For: 3.4.0
>         Attachments: ZOOKEEPER-767.patch, ZOOKEEPER-767.patch
> Networked Insights would like to share-back some code for shared/exclusive 
> locking that we are using in our labs.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

Reply via email to