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



##########
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:
       I think this is what `closeAsync()` does. It checks whether a shut down 
is in progress. If not, then it triggers it. If yes, then it simply returns the 
`terminationFuture`.




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