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



##########
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:
       You are right. I overlooked the `clusterEntrypoint.closeAsync()`.
   
   I am trying to add some tests for this approach and will update this PR soon.




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