GJL commented on a change in pull request #6785: [FLINK-10309][rest] Before 
shutting down cluster, wait for asynchronous operations
URL: https://github.com/apache/flink/pull/6785#discussion_r223996551
 
 

 ##########
 File path: 
flink-runtime/src/main/java/org/apache/flink/runtime/entrypoint/component/DispatcherResourceManagerComponent.java
 ##########
 @@ -126,15 +125,36 @@ public T getDispatcher() {
                return webMonitorEndpoint;
        }
 
-       @Override
-       public CompletableFuture<Void> closeAsync() {
+       /**
+        * Deregister the Flink application from the resource management system 
by signalling
+        * the {@link ResourceManager}.
+        *
+        * @param applicationStatus to terminate the application with
+        * @param diagnostics additional information about the shut down, can 
be {@code null}
+        * @return Future which is completed once the shut down
+        */
+       public CompletableFuture<Void> deregisterApplicationAndClose(
+                       final ApplicationStatus applicationStatus,
+                       final @Nullable String diagnostics) {
+
                if (isRunning.compareAndSet(true, false)) {
-                       return 
FutureUtils.composeAfterwards(webMonitorEndpoint.closeAsync(), 
this::closeAsyncInternal);
+                       final CompletableFuture<Void> 
closeWebMonitorAndRegisterAppFuture =
+                               
FutureUtils.composeAfterwards(webMonitorEndpoint.closeAsync(), () -> 
deregisterApplication(applicationStatus, diagnostics));
 
 Review comment:
   Yes, because deregister is an RPC. If you shutdown the ResourceManager 
before deregistration, the message is lost.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to