kumar-mallikarjuna commented on code in PR #25027:
URL: https://github.com/apache/flink/pull/25027#discussion_r1681117423
##########
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:
Is [initializing these
attributes](https://github.com/apache/flink/blob/583aadf97b2e3ddc87d4d244c5d62823e82513b1/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java#L272-L333)
outside of the `Dispatcher` constructor a bad idea (since the attributes must
be final)?
I'm thinking instead of having the constructor chain, we could have two
"base" constructors for `Dispatcher` only:
I:
```java
public Dispatcher(
RpcService rpcService,
DispatcherId fencingToken,
Collection<JobGraph> recoveredJobs,
Collection<JobResult> recoveredDirtyJobs,
DispatcherBootstrapFactory dispatcherBootstrapFactory,
DispatcherServices dispatcherServices)
```
and
II:
```java
protected Dispatcher(
RpcService rpcService,
DispatcherId fencingToken,
Collection<JobGraph> recoveredJobs,
Collection<JobResult> recoveredDirtyJobs,
DispatcherBootstrapFactory dispatcherBootstrapFactory,
DispatcherServices dispatcherServices,
JobManagerRunnerRegistry jobManagerRunnerRegistry,
ResourceCleanerFactory resourceCleanerFactory)
```
which call `super()` and a method `initDispatcher(...)` - to populate the
attributes.
This way, we'll have a separate constructor for tests which can receive
`jobManagerRunnerRegistry/resourceCleanerFactory` and we can build these two
params in constructor (I).
##########
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:
Is [initializing these
attributes](https://github.com/apache/flink/blob/583aadf97b2e3ddc87d4d244c5d62823e82513b1/flink-runtime/src/main/java/org/apache/flink/runtime/dispatcher/Dispatcher.java#L272-L333)
outside of the `Dispatcher` constructor a bad idea (since the attributes must
be `final`)?
I'm thinking instead of having the constructor chain, we could have two
"base" constructors for `Dispatcher` only:
I:
```java
public Dispatcher(
RpcService rpcService,
DispatcherId fencingToken,
Collection<JobGraph> recoveredJobs,
Collection<JobResult> recoveredDirtyJobs,
DispatcherBootstrapFactory dispatcherBootstrapFactory,
DispatcherServices dispatcherServices)
```
and
II:
```java
protected Dispatcher(
RpcService rpcService,
DispatcherId fencingToken,
Collection<JobGraph> recoveredJobs,
Collection<JobResult> recoveredDirtyJobs,
DispatcherBootstrapFactory dispatcherBootstrapFactory,
DispatcherServices dispatcherServices,
JobManagerRunnerRegistry jobManagerRunnerRegistry,
ResourceCleanerFactory resourceCleanerFactory)
```
which call `super()` and a method `initDispatcher(...)` - to populate the
attributes.
This way, we'll have a separate constructor for tests which can receive
`jobManagerRunnerRegistry/resourceCleanerFactory` and we can build these two
params in constructor (I).
--
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]