Skip to content

Commit 04de0d1

Browse files
committed
添加motan支持
1 parent f6df42d commit 04de0d1

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

tx-client/src/main/java/com/codingapi/tx/netty/handler/TransactionHandler.java

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,14 @@ public TransactionHandler(NettyControlService nettyControlService, int delay) {
4343
}
4444

4545

46-
4746
@Override
4847
public void channelRead(final ChannelHandlerContext ctx, final Object msg) throws Exception {
4948

5049
final String json = SocketUtils.getJson(msg);
5150
logger.info("接受->" + json);
5251

5352

54-
nettyControlService.executeService(ctx,json);
53+
nettyControlService.executeService(ctx, json);
5554
}
5655

5756
@Override
@@ -76,9 +75,18 @@ public void channelActive(ChannelHandlerContext ctx) throws Exception {
7675
logger.info("建立链接-->" + ctx);
7776

7877
nettyControlService.uploadModelInfo();
78+
//通道激活后进行心跳检查
79+
SocketUtils.sendMsg(ctx, heartJson);
7980
}
8081

8182

83+
/**
84+
* 当客户端的所有ChannelHandler中4s内没有write事件,则会触发userEventTriggered方法
85+
*
86+
* @param ctx
87+
* @param evt
88+
* @throws Exception
89+
*/
8290
@Override
8391
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
8492
//心跳配置

0 commit comments

Comments
 (0)