Fetch unhandled curator exceptions (#6131)

* fix: stop druid on unhandled curator exceptions

* catch exceptions when stopping lifecycle
This commit is contained in:
Christoph Hösler 2018-08-10 06:47:42 +02:00 committed by Jihoon Son
parent b0805540af
commit 1a37dfdcd1
1 changed files with 10 additions and 0 deletions

View File

@ -91,6 +91,16 @@ public class CuratorModule implements Module
.aclProvider(config.getEnableAcl() ? new SecuredACLProvider() : new DefaultACLProvider())
.build();
framework.getUnhandledErrorListenable().addListener((message, e) -> {
log.error(e, "Unhandled error in Curator Framework");
try {
lifecycle.stop();
}
catch (Throwable t) {
log.warn(t, "Exception when stopping druid lifecycle");
}
});
lifecycle.addHandler(
new Lifecycle.Handler()
{