@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { // Initialize the message. ping = ctx.alloc().buffer(RpcConstants.PING_PACKET.length()) .writeBytes(RpcConstants.PING_PACKET.getBytes(Charset.defaultCharset())); IdleStateHandler handler = ctx.pipeline().get(IdleStateHandler.class); if(handler != null && handler.getWriterIdleTimeInMillis() > 0) { enableMonitor = true; } super.channelActive(ctx); }
@Override public void channelActive(ChannelHandlerContext ctx) throws Exception { // Initialize the message. ping = ctx.alloc().buffer(RpcConstants.PING_PACKET.length()) .writeBytes(RpcConstants.PING_PACKET.getBytes(Charset.defaultCharset())); IdleStateHandler handler = ctx.pipeline().get(IdleStateHandler.class); if(handler != null && handler.getWriterIdleTimeInMillis() > 0) { enableMonitor = true; } super.channelActive(ctx); }