Class TreeCache.Builder

java.lang.Object
org.apache.curator.framework.recipes.cache.TreeCache.Builder
Enclosing class:
TreeCache

public static final class TreeCache.Builder extends Object
  • Method Details

    • build

      public TreeCache build()
      Builds the TreeCache based on configured values.
    • setCacheData

      public TreeCache.Builder setCacheData(boolean cacheData)
      Sets whether or not to cache byte data per node; default true.
    • setDataIsCompressed

      public TreeCache.Builder setDataIsCompressed(boolean dataIsCompressed)
      Sets whether or to decompress node data; default false.
    • setExecutor

      public TreeCache.Builder setExecutor(ThreadFactory threadFactory)
      Sets the executor to publish events; a default executor will be created if not specified.
    • setExecutor

      public TreeCache.Builder setExecutor(ExecutorService executorService)
      Sets the executor to publish events; a default executor will be created if not specified.
    • setMaxDepth

      public TreeCache.Builder setMaxDepth(int maxDepth)
      Sets the maximum depth to explore/watch. A maxDepth of 0 will watch only the root node (like NodeCache); a maxDepth of 1 will watch the root node and its immediate children (kind of like PathChildrenCache. Default: Integer.MAX_VALUE
    • setCreateParentNodes

      public TreeCache.Builder setCreateParentNodes(boolean createParentNodes)
      By default, TreeCache does not auto-create parent nodes for the cached path. Change this behavior with this method. NOTE: parent nodes are created as containers
      Parameters:
      createParentNodes - true to create parent nodes
      Returns:
      this for chaining
    • disableZkWatches

      public TreeCache.Builder disableZkWatches(boolean disableZkWatches)
      By default, TreeCache creates ZooKeeper watches for every created path. Change this behavior with this method.
      Parameters:
      disableZkWatches - true to disable zk watches
      Returns:
      this for chaining
    • setSelector

      public TreeCache.Builder setSelector(TreeCacheSelector selector)
      By default, DefaultTreeCacheSelector is used. Change the selector here.
      Parameters:
      selector - new selector
      Returns:
      this for chaining