tillrohrmann commented on a change in pull request #15396:
URL: https://github.com/apache/flink/pull/15396#discussion_r605453994



##########
File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/ClusterEntrypoint.java
##########
@@ -579,6 +580,19 @@ protected static Configuration loadConfiguration(
 
     public static void runClusterEntrypoint(ClusterEntrypoint 
clusterEntrypoint) {
 
+        // Register the signal handler so that we could have the chance to 
execute the shutdown
+        // supplier before handling the signal.
+        SignalHandler.register(
+                LOG,
+                () -> {
+                    if (clusterEntrypoint.isShutDown.get()) {
+                        LOG.info("Waiting for concurrent shutDownAsync 
finished.");
+                        return 
clusterEntrypoint.terminationFuture.thenAccept(ignored -> {});
+                    } else {
+                        return FutureUtils.completedVoidFuture();
+                    }
+                });

Review comment:
       Why do you think that `clusterEntrypoint.closeAsync().join()` would not 
work? Shouldn't `closeAsync` simply return the `terminationFuture` if there was 
another `shutDownAsync` operation before?
   
   I prefer the `closeAsync()` a bit because it does not rely on knowing the 
internals of the `ClusterEntrypoint` (e.g. that there is a `isShutDown` field 
and a `terminationFuture` field).




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


Reply via email to