Repository: curator
Updated Branches:
  refs/heads/master d3bccce4e -> 6d392ecb9


CURATOR-279 - Semaphore Leases should return the node name


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

Branch: refs/heads/master
Commit: 6d392ecb929b292ea9438b0e177c4bbab2c3953b
Parents: d3bccce
Author: Tsuyoshi Ozawa <oz...@apache.org>
Authored: Thu Dec 22 12:18:47 2016 +0900
Committer: Tsuyoshi Ozawa <oz...@apache.org>
Committed: Sun Jan 8 23:14:33 2017 +0900

----------------------------------------------------------------------
 .../framework/recipes/locks/InterProcessSemaphore.java       | 6 ++++++
 .../framework/recipes/locks/InterProcessSemaphoreV2.java     | 5 +++++
 .../org/apache/curator/framework/recipes/locks/Lease.java    | 8 ++++++++
 3 files changed, 19 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/6d392ecb/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphore.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphore.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphore.java
index 4d1f064..2e6db02 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphore.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphore.java
@@ -26,6 +26,7 @@ import 
org.apache.curator.framework.recipes.shared.SharedCountListener;
 import org.apache.curator.framework.recipes.shared.SharedCountReader;
 import org.apache.curator.framework.state.ConnectionState;
 import org.apache.curator.utils.ThreadUtils;
+import org.apache.curator.utils.ZKPaths;
 import org.apache.zookeeper.KeeperException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -287,6 +288,11 @@ public class InterProcessSemaphore
             {
                 return internals.getClient().getData().forPath(path);
             }
+
+            @Override
+            public String getNodeName() {
+                return ZKPaths.getNodeFromPath(path);
+            }
         };
     }
 }

http://git-wip-us.apache.org/repos/asf/curator/blob/6d392ecb/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
index 2b9d48d..03929f3 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/InterProcessSemaphoreV2.java
@@ -452,6 +452,11 @@ public class InterProcessSemaphoreV2
             {
                 return client.getData().forPath(path);
             }
+
+            @Override
+            public String getNodeName() {
+                return ZKPaths.getNodeFromPath(path);
+            }
         };
     }
 

http://git-wip-us.apache.org/repos/asf/curator/blob/6d392ecb/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Lease.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Lease.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Lease.java
index f4e0253..c99f51e 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Lease.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/locks/Lease.java
@@ -43,4 +43,12 @@ public interface Lease extends Closeable
      * @throws Exception errors
      */
     public byte[]   getData() throws Exception;
+
+    /**
+     * Return the the node for this lease
+     *
+     * @return data
+     * @throws Exception errors
+     */
+    public String getNodeName();
 }

Reply via email to