updated comments
Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/4e548a29 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/4e548a29 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/4e548a29 Branch: refs/heads/CURATOR-105 Commit: 4e548a29e60c3de1809db4eedf320e38f925671e Parents: c6700f0 Author: randgalt <randg...@apache.org> Authored: Fri May 23 07:25:00 2014 -0500 Committer: randgalt <randg...@apache.org> Committed: Fri May 23 07:25:00 2014 -0500 ---------------------------------------------------------------------- .../curator/framework/recipes/locks/LockInternals.java | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/curator/blob/4e548a29/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java ---------------------------------------------------------------------- diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java index 0f7460f..812cfd8 100644 --- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java +++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/LockInternals.java @@ -296,6 +296,7 @@ public class LockInternals { try { + // use getData instead of exists to avoid leaving unneeded watchers which is a type of resource leak client.getData().usingWatcher(watcher).forPath(previousSequencePath); if ( millisToWait != null ) { @@ -316,16 +317,10 @@ public class LockInternals } catch ( KeeperException.NoNodeException e ) { - // ignore - clearly already deleted - } - catch ( Exception e) - { - // bubble it up - throw e; + // it has been deleted (i.e. lock released). Try to acquire again } } } - // else it may have been deleted (i.e. lock released). Try to acquire again } } catch ( Exception e )