未验证 提交 fbef290c 编写于 作者: R ruanwenjun 提交者: GitHub

[Bug][Service] All tasks that need to send attachment will fail due to chennel idle (#5442)

上级 25727d2d
......@@ -184,9 +184,11 @@ public class NettyClientHandler extends ChannelInboundHandlerAdapter {
Command heartBeat = new Command();
heartBeat.setType(CommandType.HEART_BEAT);
heartBeat.setBody(heartBeatData);
ctx.writeAndFlush(heartBeat)
ctx.channel().writeAndFlush(heartBeat)
.addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
if (logger.isDebugEnabled()) {
logger.debug("Client send heart beat to: {}", ChannelUtils.getRemoteAddress(ctx.channel()));
}
} else {
super.userEventTriggered(ctx, evt);
}
......
......@@ -116,6 +116,12 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
*/
private void processReceived(final Channel channel, final Command msg) {
final CommandType commandType = msg.getType();
if (CommandType.HEART_BEAT.equals(commandType)) {
if (logger.isDebugEnabled()) {
logger.debug("server receive heart beat from: host: {}", ChannelUtils.getRemoteAddress(channel));
}
return;
}
final Pair<NettyRequestProcessor, ExecutorService> pair = processors.get(commandType);
if (pair != null) {
Runnable r = () -> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册