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 2015/11/05 22:01:46 UTC

curator git commit: Add getNodeName() to Lease

Repository: curator
Updated Branches:
  refs/heads/CURATOR-279 [created] 09551ef4b


Add getNodeName() to Lease


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

Branch: refs/heads/CURATOR-279
Commit: 09551ef4b9c3c04b8368cc0598c59997dd9614f6
Parents: 3862ada
Author: randgalt <ra...@apache.org>
Authored: Thu Nov 5 16:01:32 2015 -0500
Committer: randgalt <ra...@apache.org>
Committed: Thu Nov 5 16:01:32 2015 -0500

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


http://git-wip-us.apache.org/repos/asf/curator/blob/09551ef4/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 3d29aa8..af4b43f 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
@@ -25,6 +25,7 @@ import org.apache.curator.framework.CuratorFramework;
 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.ZKPaths;
 import org.apache.zookeeper.KeeperException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -283,6 +284,12 @@ 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/09551ef4/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 f4af39b..5db63ca 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
@@ -422,6 +422,12 @@ 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/09551ef4/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..f0cd4af 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,11 @@ public interface Lease extends Closeable
      * @throws Exception errors
      */
     public byte[]   getData() throws Exception;
+
+    /**
+     * Returns the node name the corresponds to this Lease
+     *
+     * @return node name
+     */
+    public String getNodeName();
 }