Only create parent nodes in foreground if buildInitial is true

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

Branch: refs/heads/CURATOR-3.0
Commit: f02fb225d531506444b54cdf5effb0529a35cdb0
Parents: 4b59a5b
Author: randgalt <[email protected]>
Authored: Tue Feb 2 10:39:03 2016 -0500
Committer: randgalt <[email protected]>
Committed: Tue Feb 2 10:39:03 2016 -0500

----------------------------------------------------------------------
 .../org/apache/curator/framework/recipes/cache/NodeCache.java   | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/curator/blob/f02fb225/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
----------------------------------------------------------------------
diff --git 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
index eb81893..0e05e11 100644
--- 
a/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
+++ 
b/curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/NodeCache.java
@@ -167,10 +167,9 @@ public class NodeCache implements Closeable
 
         
client.getConnectionStateListenable().addListener(connectionStateListener);
 
-        client.checkExists().creatingParentContainersIfNeeded().forPath(path);
-
         if ( buildInitial )
         {
+            
client.checkExists().creatingParentContainersIfNeeded().forPath(path);
             internalRebuild();
         }
         reset();
@@ -240,7 +239,7 @@ public class NodeCache implements Closeable
     {
         if ( (state.get() == State.STARTED) && isConnected.get() )
         {
-            
client.checkExists().usingWatcher(watcher).inBackground(backgroundCallback).forPath(path);
+            
client.checkExists().creatingParentContainersIfNeeded().usingWatcher(watcher).inBackground(backgroundCallback).forPath(path);
         }
     }
 

Reply via email to