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


##########
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:
   I kinda preferred how this was modeled as a completable future in the 
lifecycle manager.



-- 
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