JunRuiLee commented on code in PR #26489:
URL: https://github.com/apache/flink/pull/26489#discussion_r2052656518
##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java:
##########
@@ -1596,6 +1608,12 @@ CompletableFuture<Void> getJobTerminationFuture(JobID
jobId) {
jobId, CompletableFuture.completedFuture(null));
}
+ @VisibleForTesting
+ CompletableFuture<Void> addJobTerminationFuture(
Review Comment:
We could reuse the method registerJobManagerRunnerTerminationFuture and
annotate it as VisibleForTesting.
##########
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:
minor questions: Should this future wait for the completion of
allJobsTerminationFuture, or should it directly return as a completed future?
--
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]