Aitozi commented on a change in pull request #17053:
URL: https://github.com/apache/flink/pull/17053#discussion_r701211503
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/util/ZooKeeperUtils.java
##########
@@ -224,11 +229,34 @@ public static CuratorFramework
startCuratorFramework(Configuration configuration
curatorFrameworkBuilder.connectionStateErrorPolicy(
new SessionConnectionStateErrorPolicy());
}
+ return startCuratorFramework(curatorFrameworkBuilder,
fatalErrorHandler);
+ }
- CuratorFramework cf = curatorFrameworkBuilder.build();
-
+ /**
+ * Starts a {@link CuratorFramework} instance and connects it to the given
ZooKeeper quorum from
+ * a builder.
+ *
+ * @param builder {@link CuratorFrameworkFactory.Builder} A builder for
curatorFramework.
+ * @param fatalErrorHandler {@link FatalErrorHandler} fatalErrorHandler to
handle unExpected
+ * error of {@link CuratorFramework}
+ * @return {@link CuratorFramework} instance
+ */
+ static CuratorFramework startCuratorFramework(
+ CuratorFrameworkFactory.Builder builder, FatalErrorHandler
fatalErrorHandler) {
+ CuratorFramework cf = builder.build();
+ UnhandledErrorListener unhandledErrorListener =
+ (message, throwable) -> {
+ LOG.error(
+ "Unhandled error in curator framework, error
message: {}",
+ message,
+ throwable);
+ // The exception thrown in UnhandledErrorListener will be
catch by
Review comment:
I comment to draw attention to `UnhandledErrorListener` will catch all
exception when executed. The `FatalErrorHandler` used here should be aware of
this. If a handler just throw an exception may be eat by curator framework.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]