[
https://issues.apache.org/jira/browse/CURATOR-144?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14127686#comment-14127686
]
ASF GitHub Bot commented on CURATOR-144:
----------------------------------------
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.
> 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.3.4#6332)