XComp commented on code in PR #22764:
URL: https://github.com/apache/flink/pull/22764#discussion_r1228338586
##########
flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/RobustActorSystem.java:
##########
@@ -85,17 +86,52 @@ private static RobustActorSystem create(
.map(BootstrapSetup::defaultExecutionContext)
.flatMap(RobustActorSystem::toJavaOptional));
+ final PostShutdownClassLoadingErrorFilter
postShutdownClassLoadingErrorFilter =
+ new
PostShutdownClassLoadingErrorFilter(uncaughtExceptionHandler);
+
final RobustActorSystem robustActorSystem =
new RobustActorSystem(name, appConfig, classLoader, defaultEC,
setup) {
@Override
public Thread.UncaughtExceptionHandler
uncaughtExceptionHandler() {
- return
uncaughtExceptionHandler.getOrElse(super::uncaughtExceptionHandler);
+ return postShutdownClassLoadingErrorFilter;
}
};
+ robustActorSystem.registerOnTermination(
+ postShutdownClassLoadingErrorFilter::notifyShutdownComplete);
+
robustActorSystem.start();
return robustActorSystem;
}
+ private static class PostShutdownClassLoadingErrorFilter
+ implements Thread.UncaughtExceptionHandler {
+
+ private final AtomicBoolean shutdownComplete = new AtomicBoolean();
+ private final Thread.UncaughtExceptionHandler uncaughtExceptionHandler;
+
+ public PostShutdownClassLoadingErrorFilter(
+ Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
+ this.uncaughtExceptionHandler = uncaughtExceptionHandler;
+ }
+
+ public void notifyShutdownComplete() {
+ shutdownComplete.set(true);
+ }
+
+ @Override
+ public void uncaughtException(Thread t, Throwable e) {
+ if (shutdownComplete.get()
+ && (e instanceof NoClassDefFoundError || e instanceof
ClassNotFoundException)) {
Review Comment:
ah ok, I actually wanted to check where the class is used but forgot. You're
right - it doesn't make a difference. then.
--
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]