use maybeWatch

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

Branch: refs/heads/CURATOR-477
Commit: 7e9628ee5ea90d7260ce04e0625d52a68a5d2789
Parents: b7c902a
Author: Rama <[email protected]>
Authored: Tue Sep 25 17:18:05 2018 +0530
Committer: Rama <[email protected]>
Committed: Tue Sep 25 17:18:05 2018 +0530

----------------------------------------------------------------------
 .../org/apache/curator/framework/recipes/cache/TreeCache.java  | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/7e9628ee/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
index e6119f5..f42c1d5 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
@@ -347,11 +347,7 @@ public class TreeCache implements Closeable
             if ( parent == null )
             {
                 // Root node; use an exist query to watch for existence.
-                if (disableZkWatches) {
-                    client.checkExists().forPath(path);
-                } else {
-                    
client.checkExists().usingWatcher(this).inBackground(this).forPath(path);
-                }
+                maybeWatch(client.checkExists()).forPath(path);
             }
             else
             {

Reply via email to