curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From madrob <...@git.apache.org>
Subject [GitHub] curator pull request: CURATOR-144: TreeCache.Builder to configure ...
Date Fri, 22 Aug 2014 21:09:58 GMT
Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/41#discussion_r16621651
  
    --- Diff: curator-recipes/src/main/java/org/apache/curator/framework/recipes/cache/TreeCache.java
---
    @@ -356,51 +456,24 @@ public void stateChanged(CuratorFramework client, ConnectionState
newState)
             }
         };
     
    -    private static final ThreadFactory defaultThreadFactory = ThreadUtils.newThreadFactory("TreeCache");
    -
    -    /**
    -     * @param client    the client
    -     * @param path      path to watch
    -     * @param cacheData if true, node contents are cached in addition to the stat
    -     */
    -    public TreeCache(CuratorFramework client, String path, boolean cacheData)
    -    {
    -        this(client, path, cacheData, false, new CloseableExecutorService(Executors.newSingleThreadExecutor(defaultThreadFactory),
true));
    -    }
    -
    -    /**
    -     * @param client        the client
    -     * @param path          path to watch
    -     * @param cacheData     if true, node contents are cached in addition to the stat
    -     * @param threadFactory factory to use when creating internal threads
    -     */
    -    public TreeCache(CuratorFramework client, String path, boolean cacheData, ThreadFactory
threadFactory)
    -    {
    -        this(client, path, cacheData, false, new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory),
true));
    -    }
    +    static final ThreadFactory defaultThreadFactory = ThreadUtils.newThreadFactory("TreeCache");
     
         /**
    -     * @param client           the client
    -     * @param path             path to watch
    -     * @param cacheData        if true, node contents are cached in addition to the stat
    -     * @param dataIsCompressed if true, data in the path is compressed
    -     * @param threadFactory    factory to use when creating internal threads
    -     */
    -    public TreeCache(CuratorFramework client, String path, boolean cacheData, boolean
dataIsCompressed, ThreadFactory threadFactory)
    -    {
    -        this(client, path, cacheData, dataIsCompressed, new CloseableExecutorService(Executors.newSingleThreadExecutor(threadFactory),
true));
    -    }
    -
    -    /**
    -     * @param client           the client
    -     * @param path             path to watch
    -     * @param cacheData        if true, node contents are cached in addition to the stat
    -     * @param dataIsCompressed if true, data in the path is compressed
    -     * @param executorService  ExecutorService to use for the TreeCache's background
thread
    +     * Create a TreeCache for the given client and path with default options.
    +     *
    +     * If the client is namespaced, all operations on the resulting TreeCache will be
in terms of
    +     * the namespace, including all published events.  The given path is the root at
which the
    +     * TreeCache will watch and explore.  If no node exists at the given path, the TreeCache
will
    +     * be initially empty.
    +     *
    +     * @see #newBuilder(CuratorFramework, String)
    +     * @param client the client to use; may be namespaced
    +     * @param path the path to the root node to watch/explore; this path need not actually
exist on
    +     *             the server
          */
    -    public TreeCache(CuratorFramework client, String path, boolean cacheData, boolean
dataIsCompressed, final ExecutorService executorService)
    +    public TreeCache(CuratorFramework client, String path)
    --- End diff --
    
    Is it confusing to have both a public constructor and a builder available? I think I'd
prefer to expose only the builder.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message