You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@twill.apache.org by ch...@apache.org on 2014/04/22 08:06:16 UTC

[19/50] [abbrv] git commit: [PATCH] [TWILL-38] Not setting watch in RewatchOnExpireZKClient if input watcher is null.

[PATCH] [TWILL-38] Not setting watch in RewatchOnExpireZKClient if input watcher is null.

Signed-off-by: poorna <po...@continuuity.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-twill/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-twill/commit/bb24c023
Tree: http://git-wip-us.apache.org/repos/asf/incubator-twill/tree/bb24c023
Diff: http://git-wip-us.apache.org/repos/asf/incubator-twill/diff/bb24c023

Branch: refs/heads/site
Commit: bb24c023639a76d009f71a4c516b554a9608e41b
Parents: df8e278
Author: poorna <po...@continuuity.com>
Authored: Fri Jan 31 12:59:27 2014 -0800
Committer: poorna <po...@continuuity.com>
Committed: Fri Jan 31 13:06:04 2014 -0800

----------------------------------------------------------------------
 .../twill/internal/zookeeper/RewatchOnExpireZKClient.java   | 9 +++++++++
 1 file changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-twill/blob/bb24c023/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireZKClient.java
----------------------------------------------------------------------
diff --git a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireZKClient.java b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireZKClient.java
index 70db61c..bd3bd2d 100644
--- a/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireZKClient.java
+++ b/twill-zookeeper/src/main/java/org/apache/twill/internal/zookeeper/RewatchOnExpireZKClient.java
@@ -40,6 +40,9 @@ public final class RewatchOnExpireZKClient extends ForwardingZKClient {
 
   @Override
   public OperationFuture<Stat> exists(String path, Watcher watcher) {
+    if (watcher == null) {
+      return super.exists(path, watcher);
+    }
     final RewatchOnExpireWatcher wrappedWatcher = new RewatchOnExpireWatcher(this, ActionType.EXISTS, path, watcher);
     OperationFuture<Stat> result = super.exists(path, wrappedWatcher);
     Futures.addCallback(result, new FutureCallback<Stat>() {
@@ -58,6 +61,9 @@ public final class RewatchOnExpireZKClient extends ForwardingZKClient {
 
   @Override
   public OperationFuture<NodeChildren> getChildren(String path, Watcher watcher) {
+    if (watcher == null) {
+      return super.getChildren(path, watcher);
+    }
     final RewatchOnExpireWatcher wrappedWatcher = new RewatchOnExpireWatcher(this, ActionType.CHILDREN, path, watcher);
     OperationFuture<NodeChildren> result = super.getChildren(path, wrappedWatcher);
     Futures.addCallback(result, new FutureCallback<NodeChildren>() {
@@ -76,6 +82,9 @@ public final class RewatchOnExpireZKClient extends ForwardingZKClient {
 
   @Override
   public OperationFuture<NodeData> getData(String path, Watcher watcher) {
+    if (watcher == null) {
+      return super.getData(path, watcher);
+    }
     final RewatchOnExpireWatcher wrappedWatcher = new RewatchOnExpireWatcher(this, ActionType.DATA, path, watcher);
     OperationFuture<NodeData> result = super.getData(path, wrappedWatcher);
     Futures.addCallback(result, new FutureCallback<NodeData>() {