XComp commented on code in PR #21740:
URL: https://github.com/apache/flink/pull/21740#discussion_r1082532829


##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/runner/DefaultDispatcherRunner.java:
##########
@@ -89,11 +93,29 @@ public CompletableFuture<Void> closeAsync() {
             }
         }
 
+        Exception exception = null;
+        try {
+            leaderElectionService.stop();
+        } catch (Exception e) {
+            exception = e;
+        }
+        final Exception leaderElectionServiceShutdownException = exception;
+
         stopDispatcherLeaderProcess();
 
         FutureUtils.forward(previousDispatcherLeaderProcessTerminationFuture, 
terminationFuture);
 
-        return terminationFuture;
+        return terminationFuture.whenComplete(
+                (ignoredResult, terminationThrowable) -> {
+                    if (terminationThrowable != null) {
+                        throw new CompletionException(
+                                ExceptionUtils.firstOrSuppressed(
+                                        terminationThrowable,
+                                        
leaderElectionServiceShutdownException));

Review Comment:
   Fair point. I don't know, why I didn't come up with a simple copy&paste. I 
updated the code. This also fixed the compilation error where some imports were 
missing.



-- 
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: issues-unsubscr...@flink.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to