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


##########
flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/DefaultJobManagerRunnerRegistry.java:
##########
@@ -97,6 +106,14 @@ public JobManagerRunner unregister(JobID jobId) {
         return this.jobManagerRunners.remove(jobId);
     }
 
+    public void setMainThreadExecutor(ComponentMainThreadExecutor executor) {
+        mainThreadExecutor = executor;
+    }
+
+    public ComponentMainThreadExecutor getMainThreadExecutor() {
+        return mainThreadExecutor;
+    }
+

Review Comment:
   yeah, I just noticed when thinking about it that using the Builder pattern 
doesn't make a difference. Essentially, it's about adding the 
`JobManagerRunnerRegistry` to the `create*ResourceCleaner` method signatures of 
the `ResourceCleanerFactory` which is a bit unfortunate.
   
   But what we can do is making the main thread passing an implementation 
detail of the `DispatcherResourceCleanerFactory`: We could introduce a twin 
interface `LocallyCleanableWithMainThreadResource`:
   ```java
   @FunctionalInterface
   public interface LocallyCleanableInMainThreadResource {
   
       CompletableFuture<Void> localCleanupAsync(
               JobID jobId, Executor cleanupExecutor, Executor 
mainThreadExecutor);
   }
   ```
   
   That interface can be converted to a `LocallyCleanableResource` in 
`DispatcherResourceCleanerFactory`. We wouldn't have to change the `Dispatcher` 
instantiation in that case. WDYT?



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