[ 
https://issues.apache.org/jira/browse/ZOOKEEPER-78?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12697683#action_12697683
 ] 

Benjamin Reed commented on ZOOKEEPER-78:
----------------------------------------

wow nice work. it's nice to have someone that knows automake again!

some comments:

in unlock, we shouldn't call the callback if the unlock had an error should we?

in zope.execute() how would id be null in the 2nd if block?

Collections.sort() would simplify your sorting wouldn't it?

if exists() fails when trying to grab the lock, you need to get a new child 
list and retry.

for both C and java, shouldn't the lock and unlock be synchronized?

in zoo_mutex_lock you always nano_sleep. wouldn't it be better to only 
nano_sleep if you have to retry?

i think the logic for checking for a previous create with getChildren and 
create should be implemented the same in C and java.

with regard to that last comment: currently we do a getChildren() see if a 
previous create suceeded and then do a create(). one problem with this is that 
a previously issued create may still be in flight. i think it would be better 
and simpler to keep doing create until you succeed; do a getChildren(); delete 
any duplicates.


> added a high level protocol/feature - for easy Leader Election or exclusive 
> Write Lock creation
> -----------------------------------------------------------------------------------------------
>
>                 Key: ZOOKEEPER-78
>                 URL: https://issues.apache.org/jira/browse/ZOOKEEPER-78
>             Project: Zookeeper
>          Issue Type: New Feature
>          Components: java client
>    Affects Versions: 3.0.0
>            Reporter: james strachan
>            Assignee: Mahadev konar
>             Fix For: 3.2.0
>
>         Attachments: patch_with_including_Benjamin's_fix.patch, 
> using_zookeeper_facade.patch, ZOOKEEPER-78.patch, ZOOKEEPER-78.patch, 
> ZOOKEEPER-78.patch, ZOOKEEPER-78.patch, ZOOKEEPER-78.patch, 
> ZOOKEEPER-78.patch, ZOOKEEPER-78.patch
>
>
> Here's a patch which adds a little WriteLock helper class for performing 
> leader elections or creating exclusive locks in some directory znode. Note 
> its an early cut; am sure we can improve it over time. The aim is to avoid 
> folks having to use the low level ZK stuff but provide a simpler high level 
> abstraction.

-- 
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