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 Tue, 09 Sep 2014 22:31:12 GMT
Github user madrob commented on a diff in the pull request:

    https://github.com/apache/curator/pull/41#discussion_r17332712
  
    --- 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 --
    
    This can call buildWithListeners, since they do nearly the same thing already.


---
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