Return-Path: X-Original-To: apmail-curator-commits-archive@minotaur.apache.org Delivered-To: apmail-curator-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 22D3618B7B for ; Thu, 5 Nov 2015 21:01:47 +0000 (UTC) Received: (qmail 74350 invoked by uid 500); 5 Nov 2015 21:01:47 -0000 Delivered-To: apmail-curator-commits-archive@curator.apache.org Received: (qmail 74314 invoked by uid 500); 5 Nov 2015 21:01:46 -0000 Mailing-List: contact commits-help@curator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@curator.apache.org Delivered-To: mailing list commits@curator.apache.org Received: (qmail 74305 invoked by uid 99); 5 Nov 2015 21:01:46 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 05 Nov 2015 21:01:46 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8DEF2E56E4; Thu, 5 Nov 2015 21:01:46 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: randgalt@apache.org To: commits@curator.apache.org Message-Id: <1385b87aba5c46408f58b36d6d7b1676@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: curator git commit: Add getNodeName() to Lease Date: Thu, 5 Nov 2015 21:01:46 +0000 (UTC) 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 Authored: Thu Nov 5 16:01:32 2015 -0500 Committer: randgalt 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(); }