dawidwys commented on a change in pull request #17440:
URL: https://github.com/apache/flink/pull/17440#discussion_r732625408
##########
File path:
flink-runtime/src/main/java/org/apache/flink/runtime/io/network/netty/NettyPartitionRequestClient.java
##########
@@ -195,22 +195,26 @@ public void operationComplete(ChannelFuture future)
throws Exception {
@Override
public void notifyCreditAvailable(RemoteInputChannel inputChannel) {
- clientHandler.notifyCreditAvailable(inputChannel);
+ sendToChannel(new AddCreditMessage(inputChannel));
}
@Override
public void notifyNewBufferSize(RemoteInputChannel inputChannel, int
bufferSize) {
- clientHandler.notifyNewBufferSize(inputChannel, bufferSize);
+ sendToChannel(new NewBufferSizeMessage(inputChannel, bufferSize));
}
@Override
public void resumeConsumption(RemoteInputChannel inputChannel) {
- clientHandler.resumeConsumption(inputChannel);
+ sendToChannel(new ResumeConsumptionMessage(inputChannel));
}
@Override
public void acknowledgeAllRecordsProcessed(RemoteInputChannel
inputChannel) {
- clientHandler.acknowledgeAllRecordsProcessed(inputChannel);
+ sendToChannel(new AcknowledgeAllRecordsProcessedMessage(inputChannel));
+ }
+
+ private void sendToChannel(ClientOutboundMessage message) {
+ tcpChannel.eventLoop().execute(() ->
tcpChannel.pipeline().fireUserEventTriggered(message));
Review comment:
I am fine merging it as is. However, I am curious myself if it was/is
necessary (I could not find an answer, but I have not searched for long). But,
I am not too familiar with how netty works.
BTW, I've just looked into it again and if I go into:
`ChannelPipeline#fireUserEventTriggered` ->
`DefaultPipeline#fireUserEventTriggered` ->
`AbstractChannelHandlerContext.invokeUserEventTriggered(this.head, event);` I
can see a code like this:
```
static void invokeUserEventTriggered(final AbstractChannelHandlerContext
next, final Object event) {
ObjectUtil.checkNotNull(event, "event");
EventExecutor executor = next.executor();
if (executor.inEventLoop()) {
next.invokeUserEventTriggered(event);
} else {
executor.execute(new Runnable() {
public void run() {
next.invokeUserEventTriggered(event);
}
});
}
}
```
which would indicate submitting it explicitly from the `eventLoop` is
unnecessary.
--
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]