curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CURATOR-144) TreeCache should use a builder for advanced options
Date Fri, 22 Aug 2014 21:18:10 GMT

    [ https://issues.apache.org/jira/browse/CURATOR-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14107501#comment-14107501
] 

ASF GitHub Bot commented on CURATOR-144:
----------------------------------------

Github user dragonsinth commented on a diff in the pull request:

    https://github.com/apache/curator/pull/41#discussion_r16621936
  
    --- 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 --
    
    It's a convenience for the happy path where you don't need any extra options.
    
    `new TreeCache(client, "/")` vs. `TreeCache.newBuilder(client, "/").build()`


> TreeCache should use a builder for advanced options
> ---------------------------------------------------
>
>                 Key: CURATOR-144
>                 URL: https://issues.apache.org/jira/browse/CURATOR-144
>             Project: Apache Curator
>          Issue Type: Improvement
>          Components: Recipes
>            Reporter: Scott Blum
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>




--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message