szetszwo commented on code in PR #1285:
URL: https://github.com/apache/ratis/pull/1285#discussion_r2392148269
##########
ratis-netty/src/main/java/org/apache/ratis/netty/NettyRpcProxy.java:
##########
@@ -121,6 +125,17 @@ protected void channelRead0(ChannelHandlerContext ctx,
future.complete(proto);
}
}
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, Throwable
cause) {
+ failOutstandingRequests(new IOException("Caught an exception for the
connection to " + peer, cause));
+ client.close();
+ }
+
+ @Override
+ public void channelInactive(ChannelHandlerContext ctx) {
+ failOutstandingRequests(new AlreadyClosedException("Channel to " +
peer + " is inactive."));
Review Comment:
@leixm , @OneSizeFitsQuorum , I traced the code
super.channelInactive(ctx) is
ChannelInboundHandlerAdapter.channelInactive(ctx)
-> ChannelHandlerContext..fireChannelInactive()
-> AbstractChannelHandlerContext.fireChannelInactive()
->
AbstractChannelHandlerContext.invokeChannelInactive(this.findContextInbound(16));
-> next.invokeChannelInactive()
So, Copilot seems correct. It works only if there is no next handler.
```java
// AbstractChannelHandlerContext
static void invokeChannelInactive(final AbstractChannelHandlerContext
next) {
EventExecutor executor = next.executor();
if (executor.inEventLoop()) {
next.invokeChannelInactive();
} else {
executor.execute(new Runnable() {
@Override
public void run() {
next.invokeChannelInactive();
}
});
}
}
```
https://github.com/netty/netty/blob/d9a8b00cb15e54a1f167025bbd9ab53d466a04d3/transport/src/main/java/io/netty/channel/AbstractChannelHandlerContext.java#L278-L290
--
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]