eemario commented on code in PR #26489:
URL: https://github.com/apache/flink/pull/26489#discussion_r2053286838
##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -1093,13 +1093,25 @@ public CompletableFuture<String>
stopWithSavepointAndGetLocation(
@Override
public CompletableFuture<Acknowledge> shutDownCluster() {
- return shutDownCluster(ApplicationStatus.SUCCEEDED);
+ return internalShutDownCluster(ApplicationStatus.SUCCEEDED, false);
}
@Override
public CompletableFuture<Acknowledge> shutDownCluster(
final ApplicationStatus applicationStatus) {
- shutDownFuture.complete(applicationStatus);
+ return internalShutDownCluster(applicationStatus, true);
+ }
+
+ private CompletableFuture<Acknowledge> internalShutDownCluster(
+ final ApplicationStatus applicationStatus,
+ final boolean waitForAllJobTerminationFutures) {
+ final CompletableFuture<Void> allJobsTerminationFuture =
+ waitForAllJobTerminationFutures
+ ?
FutureUtils.completeAll(jobManagerRunnerTerminationFutures.values())
+ : CompletableFuture.completedFuture(null);
+
+ FutureUtils.runAfterwards(
+ allJobsTerminationFuture, () ->
shutDownFuture.complete(applicationStatus));
return CompletableFuture.completedFuture(Acknowledge.get());
Review Comment:
My understanding is that `shutDownCluster` method returns a
CompletableFuture<Acknowledge> to indicate that the shutdown request has been
accepted, rather than any operation has been completed. The actual shutdown
operation is performed asynchronously to avoid blocking the caller.
--
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]