tillrohrmann commented on a change in pull request #8334: [FLINK-12219] Log
uncaught exceptions and terminate in case
Dispatcher#jobReachedGloballyTerminalState fails
URL: https://github.com/apache/flink/pull/8334#discussion_r281254364
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/concurrent/FutureUtils.java
##########
@@ -969,4 +970,29 @@ public void run() {
return DELAYER.schedule(runnable, delay, timeUnit);
}
}
+
+ /**
+ * Asserts that the given {@link CompletableFuture} is not completed
exceptionally. If the future
+ * is completed exceptionally, then it will call the {@link
FatalExitExceptionHandler}.
+ *
+ * @param completableFuture to assert for no exceptions
+ */
+ public static void assertNoException(CompletableFuture<?>
completableFuture) {
+ assertNoException(completableFuture,
FatalExitExceptionHandler.INSTANCE);
+ }
+
+ /**
+ * Asserts that the given {@link CompletableFuture} is not completed
exceptionally. If the future
+ * is completed exceptionally, then it will call the given uncaught
exception handler.
+ *
+ * @param completableFuture to assert for no exceptions
+ * @param uncaughtExceptionHandler to call if the future is completed
exceptionally
+ */
+ public static void assertNoException(CompletableFuture<?>
completableFuture, Thread.UncaughtExceptionHandler uncaughtExceptionHandler) {
Review comment:
I could rename the method to `checkNoException`. Would that be better?
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services