@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (reconnect) { if (attempts < 8) attempts++; int timeout = 2 << attempts; timer.newTimeout(this, timeout, TimeUnit.MILLISECONDS); } ctx.fireChannelInactive(); }
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof IdleStateEvent) { IdleState e = ((IdleStateEvent) evt).state(); if (e == IdleState.ALL_IDLE) { // fire a channelInactive to trigger publish of Will ctx.fireChannelInactive(); ctx.close(); } /*else if (e.getState() == IdleState.WRITER_IDLE) { ctx.writeAndFlush(new PingMessage()); }*/ } }
@Override public void channelInactive(final ChannelHandlerContext remoteChannelCtx) throws Exception { LoggerUtil.debug( logger, uaChannel.attr(ApnProxyConnectionAttribute.ATTRIBUTE_KEY), "Remote channel inactive"); final String remoteAddr = uaChannel.attr(ApnProxyConnectionAttribute.ATTRIBUTE_KEY).get().getRemote().getRemoteAddr(); remoteChannelInactiveCallback.remoteChannelInactive(uaChannel, remoteAddr); remoteChannelCtx.fireChannelInactive(); }