Browse Source

注释掉不必要打印,避免内存泄漏

master
lijw 9 months ago
parent
commit
d14402f8be
2 changed files with 5 additions and 5 deletions
  1. +3
    -3
      src/main/java/com/inspect/tcpserver/tcp/MyDecoder.java
  2. +2
    -2
      src/main/java/com/inspect/tcpserver/tcp/NettyServerHandler.java

+ 3
- 3
src/main/java/com/inspect/tcpserver/tcp/MyDecoder.java View File

@ -29,8 +29,8 @@ public class MyDecoder extends ByteToMessageDecoder {
}
final String uuid = RandomStringUtils.randomAlphanumeric(16);
ByteBuf forPrint = in.copy();
log.info("######## 会话: {}, 客户: {}, 上行原始报文 ######## \n {}", uuid, ctx.channel().id().asShortText(), ByteBufUtil.hexDump(forPrint));
// ByteBuf forPrint = in.copy();
// log.info("######## 会话: {}, 客户: {}, 上行原始报文 ######## \n {}", uuid, ctx.channel().id().asShortText(), ByteBufUtil.hexDump(forPrint));
int index;
String flag;
@ -72,4 +72,4 @@ public class MyDecoder extends ByteToMessageDecoder {
}
}
}
}
}

+ 2
- 2
src/main/java/com/inspect/tcpserver/tcp/NettyServerHandler.java View File

@ -22,8 +22,8 @@ public class NettyServerHandler extends ChannelInboundHandlerAdapter {
public void sendMsg(String uuid, String clientKey, String clientValue, ByteBuf byteBuf) {
if (ids.containsKey(clientValue)) {
ByteBuf forPrint = byteBuf.copy();
logger.info("######## 会话: {}, 客户键值: {}, 客户号: {}, 下行原始报文 ########\n [{}]", uuid, clientKey, clientValue, ByteBufUtil.hexDump(forPrint));
// ByteBuf forPrint = byteBuf.copy();
// logger.info("######## 会话: {}, 客户键值: {}, 客户号: {}, 下行原始报文 ########\n [{}]", uuid, clientKey, clientValue, ByteBufUtil.hexDump(forPrint));
ids.get(clientValue).writeAndFlush(byteBuf);
}
}


Loading…
Cancel
Save