예제 #1
0
  @Override
  public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
    super.userEventTriggered(ctx, evt);

    if (evt instanceof IdleStateEvent) {
      sendGetParameters();
    }
  }
 @Override
 public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
   if (evt instanceof IdleStateEvent) {
     ctx.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate())
         .addListener(ChannelFutureListener.CLOSE_ON_FAILURE);
   } else {
     super.userEventTriggered(ctx, evt);
   }
 }
예제 #3
0
 @Override
 public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
   if (evt instanceof IdleStateEvent) {
     IdleStateEvent event = (IdleStateEvent) evt;
     if (event.state().equals(IdleState.READER_IDLE)) {
       System.out.println("READER_IDLE");
       NettyChannelMap.remove(ctx.channel());
       ctx.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate()).addListener(ChannelFutureListener.CLOSE);
     } else if (event.state().equals(IdleState.WRITER_IDLE)) {
       System.out.println("WRITER_IDLE");
     } else if (event.state().equals(IdleState.ALL_IDLE)) {
       System.out.println("ALL_IDLE");
       NettyChannelMap.remove(ctx.channel());
       ctx.writeAndFlush(HEARTBEAT_SEQUENCE.duplicate()).addListener(ChannelFutureListener.CLOSE);
     }
   } else {
     super.userEventTriggered(ctx, evt);
   }
 }