faucct commented on pull request #394:
URL: https://github.com/apache/curator/pull/394#issuecomment-933011518


   Also, I think that there would be no need to expose lock-paths and use 
transactions if Curator exposed APIs with no implicit retries, where everything 
would happen in same session:
   
   ```
   var lock = new Lock(path);
   while (true) {
     try {
       var zookeeper = curatorFramework.getZookeeperClient().getZooKeeper();
       lock.lock(zookeeper);
       try {
         zookeeper.create("");
         zookeeper.delete("");
         ...
       } finally {
         lock.unlock(zookeeper);
       }
     } catch (Exception e) {
       if (curatorFramework.retry(e)) {
         continue;
       }
       throw e;
     }
   }
   ```
   
   or even
   
   ```
   var lock = new Lock(path);
   curatorFramework.zookeeper(zookeeper -> {
     lock.lock(zookeeper);
     try {
       zookeeper.create("");
       zookeeper.delete("");
       ...
     } finally {
       lock.unlock(zookeeper);
     }
   });
   ```
   
   Would you mind me pull-requesting such APIs?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to