You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@curator.apache.org by ra...@apache.org on 2017/01/08 05:43:44 UTC

[2/6] curator git commit: fix CURATOR-376

fix CURATOR-376

Set this.lease to null before lease.close.


Project: http://git-wip-us.apache.org/repos/asf/curator/repo
Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/52c9c7d6
Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/52c9c7d6
Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/52c9c7d6

Branch: refs/heads/CURATOR-3.0
Commit: 52c9c7d6fecb8df5eb93f0f5a28a2cf3f6268091
Parents: 2ae72d6
Author: ayanamist <ay...@gmail.com>
Authored: Fri Jan 6 15:14:53 2017 +0800
Committer: ayanamist <ay...@gmail.com>
Committed: Fri Jan 6 15:14:53 2017 +0800

----------------------------------------------------------------------
 .../recipes/locks/InterProcessSemaphoreMutex.java       | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/52c9c7d6/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreMutex.java
----------------------------------------------------------------------
diff --git a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreMutex.java b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreMutex.java
index 88b5f5d..ba3b649 100644
--- a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreMutex.java
+++ b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreMutex.java
@@ -61,16 +61,10 @@ public class InterProcessSemaphoreMutex implements InterProcessLock
     @Override
     public void release() throws Exception
     {
+        Lease lease = this.lease;
         Preconditions.checkState(lease != null, "Not acquired");
-
-        try
-        {
-            lease.close();
-        }
-        finally
-        {
-            lease = null;
-        }
+        this.lease = null;
+        lease.close();
     }
 
     @Override