[2/8] curator git commit: address review feedback
address review feedback Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/88df79b4 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/88df79b4 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/88df79b4 Branch: refs/heads/master Commit: 88df79b474c252ddb97096c6e967daa38a02b545 Parents: d4a0d95 Author: Rama Authored: Sun Sep 23 13:28:23 2018 +0530 Committer: Rama Committed: Sun Sep 23 13:28:23 2018 +0530 -- .../framework/recipes/cache/TreeCache.java | 90 +++- .../framework/recipes/cache/TestTreeCache.java | 2 +- 2 files changed, 51 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/88df79b4/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 7bcc8d1..7c68868 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 @@ -19,15 +19,35 @@ package org.apache.curator.framework.recipes.cache; +import static com.google.common.base.Preconditions.checkNotNull; +import static org.apache.curator.utils.PathUtils.validatePath; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; +import java.io.Closeable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.WatcherRemoveCuratorFramework; import org.apache.curator.framework.api.BackgroundCallback; import org.apache.curator.framework.api.CuratorEvent; +import org.apache.curator.framework.api.ErrorListenerPathable; +import org.apache.curator.framework.api.GetDataBuilder; +import org.apache.curator.framework.api.GetDataWatchBackgroundStatable; import org.apache.curator.framework.api.UnhandledErrorListener; import org.apache.curator.framework.listen.Listenable; import org.apache.curator.framework.listen.ListenerContainer; @@ -42,23 +62,6 @@ import org.apache.zookeeper.Watcher; import org.apache.zookeeper.data.Stat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.Closeable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.apache.curator.utils.PathUtils.validatePath; /** * A utility that attempts to keep all data from all children of a ZK path locally cached. This class @@ -73,7 +76,7 @@ public class TreeCache implements Closeable { private static final Logger LOG = LoggerFactory.getLogger(TreeCache.class); private final boolean createParentNodes; -private final boolean createZkWatches; +private final boolean disableZkWatches; private final TreeCacheSelector selector; public static final class Builder @@ -85,7 +88,7 @@ public class TreeCache implements Closeable private ExecutorService executorService = null; private int maxDepth = Integer.MAX_VALUE; private boolean createParentNodes = false; -private boolean createZkWatches = true; +private boolean disableZkWatches = false; private TreeCacheSelector selector = new DefaultTreeCacheSelector(); private Builder(CuratorFramework client, String path) @@ -104,7 +107,7 @@ public class TreeCache implements Closeable { executor =
[2/8] curator git commit: address review feedback
address review feedback Project: http://git-wip-us.apache.org/repos/asf/curator/repo Commit: http://git-wip-us.apache.org/repos/asf/curator/commit/88df79b4 Tree: http://git-wip-us.apache.org/repos/asf/curator/tree/88df79b4 Diff: http://git-wip-us.apache.org/repos/asf/curator/diff/88df79b4 Branch: refs/heads/CURATOR-477 Commit: 88df79b474c252ddb97096c6e967daa38a02b545 Parents: d4a0d95 Author: Rama Authored: Sun Sep 23 13:28:23 2018 +0530 Committer: Rama Committed: Sun Sep 23 13:28:23 2018 +0530 -- .../framework/recipes/cache/TreeCache.java | 90 +++- .../framework/recipes/cache/TestTreeCache.java | 2 +- 2 files changed, 51 insertions(+), 41 deletions(-) -- http://git-wip-us.apache.org/repos/asf/curator/blob/88df79b4/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 7bcc8d1..7c68868 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 @@ -19,15 +19,35 @@ package org.apache.curator.framework.recipes.cache; +import static com.google.common.base.Preconditions.checkNotNull; +import static org.apache.curator.utils.PathUtils.validatePath; + import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Preconditions; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; +import java.io.Closeable; +import java.util.ArrayList; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.concurrent.ConcurrentMap; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ThreadFactory; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; +import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; import org.apache.curator.framework.CuratorFramework; import org.apache.curator.framework.WatcherRemoveCuratorFramework; import org.apache.curator.framework.api.BackgroundCallback; import org.apache.curator.framework.api.CuratorEvent; +import org.apache.curator.framework.api.ErrorListenerPathable; +import org.apache.curator.framework.api.GetDataBuilder; +import org.apache.curator.framework.api.GetDataWatchBackgroundStatable; import org.apache.curator.framework.api.UnhandledErrorListener; import org.apache.curator.framework.listen.Listenable; import org.apache.curator.framework.listen.ListenerContainer; @@ -42,23 +62,6 @@ import org.apache.zookeeper.Watcher; import org.apache.zookeeper.data.Stat; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.io.Closeable; -import java.util.ArrayList; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentMap; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.ThreadFactory; -import java.util.concurrent.atomic.AtomicBoolean; -import java.util.concurrent.atomic.AtomicLong; -import java.util.concurrent.atomic.AtomicReference; -import java.util.concurrent.atomic.AtomicReferenceFieldUpdater; - -import static com.google.common.base.Preconditions.checkNotNull; -import static org.apache.curator.utils.PathUtils.validatePath; /** * A utility that attempts to keep all data from all children of a ZK path locally cached. This class @@ -73,7 +76,7 @@ public class TreeCache implements Closeable { private static final Logger LOG = LoggerFactory.getLogger(TreeCache.class); private final boolean createParentNodes; -private final boolean createZkWatches; +private final boolean disableZkWatches; private final TreeCacheSelector selector; public static final class Builder @@ -85,7 +88,7 @@ public class TreeCache implements Closeable private ExecutorService executorService = null; private int maxDepth = Integer.MAX_VALUE; private boolean createParentNodes = false; -private boolean createZkWatches = true; +private boolean disableZkWatches = false; private TreeCacheSelector selector = new DefaultTreeCacheSelector(); private Builder(CuratorFramework client, String path) @@ -104,7 +107,7 @@ public class TreeCache implements Closeable { executor =