XComp commented on code in PR #25027:
URL: https://github.com/apache/flink/pull/25027#discussion_r1692705494


##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/DefaultJobManagerRunnerRegistry.java:
##########
@@ -83,9 +83,15 @@ public Collection<JobManagerRunner> getJobManagerRunners() {
     }
 
     @Override
-    public CompletableFuture<Void> localCleanupAsync(JobID jobId, Executor 
unusedExecutor) {
+    public CompletableFuture<Void> localCleanupAsync(JobID jobId, Executor 
mainThreadExecutor) {
         if (isRegistered(jobId)) {
-            return unregister(jobId).closeAsync();
+            CompletableFuture<Void> resultFuture = 
this.jobManagerRunners.get(jobId).closeAsync();
+
+            return resultFuture.thenApply(

Review Comment:
   One thing is that `thenApplyAsync` is the appropriate API to call a 
subsequent callback in a different thread (that's what you're currently doing 
with `mainThreadExecutor.execute`. Additionally, cleanup (i.e. the returned 
`CompletableFuture`) should be only completed after the `JobManagerRunner` is 
deregistered, IIUC. That's not the case in your current code where you trigger 
the unregister method but return the `result` right-away.



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

Reply via email to