pnowojski commented on a change in pull request #12401:
URL: https://github.com/apache/flink/pull/12401#discussion_r432373879
##########
File path:
flink-streaming-java/src/main/java/org/apache/flink/streaming/runtime/tasks/mailbox/MailboxProcessor.java
##########
@@ -114,6 +114,7 @@ public MailboxProcessor(
this.actionExecutor =
Preconditions.checkNotNull(actionExecutor);
this.mailbox = Preconditions.checkNotNull(mailbox);
this.mainMailboxExecutor =
Preconditions.checkNotNull(mainMailboxExecutor);
+ ((MailboxExecutorImpl)
this.mainMailboxExecutor).setMailboxProcessor(this);
Review comment:
Couple of problems:
1. it changes an object passed from the outside
2. requires cast (could be solved by changing the signature of the
constructor)
I'm thinking that maybe a better solution is to get rid of the
`mainMailboxExecutor` and replace getter `getMainMailboxExecutor` with:
```
public MailboxExecutor getMainMailboxExecutor() {
return new MailboxExecutorImpl(mailbox, MIN_PRIORITY,
actionExecutor, this);
}
```
plus caching access to `mailboxProcessor.getMainMailboxExecutor()` inside
`StreamTask` via creating a field in ` StreamTask`: `private final
MailboxExecutor mainMailboxExecutor`?
This would solve the problem of circular dependency and nullable non final
field inside `MailboxExecutorImpl`.
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.
For queries about this service, please contact Infrastructure at:
[email protected]