in impl/src/main/java/org/apache/rocketmq/remoting/impl/netty/handler/Encoder.java [41:57]
public void encode(final ChannelHandlerContext ctx, RemotingCommand remotingCommand, ByteBuf out) throws Exception {
try {
RemotingBuffer wrapper = new NettyRemotingBuffer(out);
encode(remotingCommand, wrapper);
} catch (final RemotingCodecException e) {
String remoteAddress = RemotingUtil.extractRemoteAddress(ctx.channel());
LOG.error(String.format("Error occurred when encoding command for channel %s", remoteAddress), e);
ctx.channel().close().addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) throws Exception {
LOG.warn("Close channel {} because of error {},result is {}", ctx.channel(), e, future.isSuccess());
}
});
}
}