|
@@ -50,20 +50,6 @@ public class GroupNettyClientHandler extends ChannelInboundHandlerAdapter {
|
|
|
this.alarmRecordRepository = alarmRecordRepository;
|
|
|
}
|
|
|
|
|
|
- @Override
|
|
|
- public void userEventTriggered(ChannelHandlerContext ctx, Object evt) {
|
|
|
-
|
|
|
- if (!(evt instanceof IdleStateEvent)) {
|
|
|
- return;
|
|
|
- }
|
|
|
- IdleStateEvent e = (IdleStateEvent) evt;
|
|
|
- if (e.state() == IdleState.READER_IDLE) {
|
|
|
- log.info("no inbound traffic");
|
|
|
- // The connection was OK but there was no traffic for last period.
|
|
|
- // 长时间不操作的时候自动关闭连接; ctx.close();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
/**
|
|
|
* 在到服务器的连接已经建立之后将被调用
|
|
|
*
|
|
@@ -206,7 +192,7 @@ public class GroupNettyClientHandler extends ChannelInboundHandlerAdapter {
|
|
|
*/
|
|
|
@Override
|
|
|
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
|
|
|
- cause.printStackTrace();
|
|
|
+ log.info("exceptionCaught",cause);
|
|
|
ctx.close();
|
|
|
}
|
|
|
|