curator-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dragonsinth <...@git.apache.org>
Subject [GitHub] curator pull request: CURATOR-144: TreeCache.Builder to configure ...
Date Thu, 02 Oct 2014 20:24:18 GMT
Github user dragonsinth commented on a diff in the pull request:

    https://github.com/apache/curator/pull/41#discussion_r18364840
  
    --- Diff: curator-recipes/src/test/java/org/apache/curator/framework/recipes/cache/BaseTestTreeCache.java
---
    @@ -57,22 +60,38 @@ public void childEvent(CuratorFramework client, TreeCacheEvent event)
throws Exc
         };
     
         /**
    -     * A TreeCache that records exceptions and automatically adds a listener.
    +     * Ensures that tests don't cause any background errors.
          */
    -    class MyTreeCache extends TreeCache
    +    final UnhandledErrorListener errorListener = new UnhandledErrorListener()
         {
    -
    -        MyTreeCache(CuratorFramework client, String path, boolean cacheData)
    -        {
    -            super(client, path, cacheData);
    -            getListenable().addListener(eventListener);
    -        }
    -
             @Override
    -        protected void handleException(Throwable e)
    +        public void unhandledError(String message, Throwable e)
             {
    -            handleBackgroundException(e);
    +            hadBackgroundException.set(true);
    +            e.printStackTrace(System.err);
             }
    +    };
    +
    +    /**
    +     * Construct a TreeCache that records exceptions and automatically listens.
    +     */
    +    protected TreeCache newTreeCacheWithListeners(CuratorFramework client, String path)
    --- End diff --
    
    I'm exercising two different code paths on purpose, the first the public ctor, the second
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