@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { if (e.getState() == IdleState.WRITER_IDLE && enabledTimeout) { e.getChannel().close(); } } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { logger.info("In IDLE event handler for TCP..."); //there are 3 states. READER/WRITER/ALL if (e.getState() == IdleState.ALL_IDLE){ int statusCodeInt = 0; String statusCode = statusCodeInt + " SUCCESSFUL"; String errMsg="idleTimeout to finish"; tcpWorker.onComplete(tcpWorker.responseSb.toString(), false, errMsg, errMsg, statusCode, statusCodeInt); } } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { // Close idle UdpChildChannel (on server side) or NioDatagramChannel (client side) e.getChannel().close(); } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (e.getState() == IdleState.ALL_IDLE) { throw new SMTPIdleException("Connection was idling for " + (System.currentTimeMillis()- e.getLastActivityTimeMillis()) + " ms"); } super.channelIdle(ctx, e); }
/** * this case is like a read timeout where did not get anything from the * server for a long time. * * For UDP need to mark as error * * @see org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler#channelIdle * (org.jboss.netty.channel.ChannelHandlerContext, * org.jboss.netty.handler.timeout.IdleStateEvent) */ @Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { logger.debug("In IDLE event handler for UDP..timeout."); // there are 3 states. READER/WRITER/ALL if (e.getState() == IdleState.ALL_IDLE) { int statusCodeInt = 1; String statusCode = statusCodeInt + " FAILURE"; String errMsg = "UDP idle (read) timeout"; udpWorker.onComplete(udpWorker.responseSb.toString(), true, errMsg, errMsg, statusCode, statusCodeInt); } } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10; OFMessage m = factory.buildEchoRequest().build(); log.debug("Sending Echo Request on idle channel: {}", e.getChannel().getPipeline().getLast().toString()); e.getChannel().write(Collections.singletonList(m)); // XXX S some problems here -- echo request has no transaction id, and // echo reply is not correlated to the echo request. }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if(e.getState() == IdleState.ALL_IDLE){ LOG.warn("Channel {} has been idle, it will be disconnected now: ",e.getChannel()); e.getChannel().close(); } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { logger.info("In IDLE event handler for TCP..."); //there are 3 states. READER/WRITER/ALL if (e.getState() == IdleState.ALL_IDLE){ int statusCodeInt = 0; String statusCode = statusCodeInt + " SUCCESSFUL"; String errMsg="idleTimeout to finish"; tcpWorker.onComplete(tcpWorker.responseSb.toString(), false, errMsg, errMsg, statusCode, statusCodeInt); } } }
@Override public void channelIdle(final ChannelHandlerContext ctx, final IdleStateEvent e) throws Exception { final OFMessage m = BasicFactory.getInstance().getMessage( OFType.ECHO_REQUEST); e.getChannel().write(Collections.singletonList(m)); }
public class IdleStateAwareHandler extends IdleStateAwareChannelHandler { @Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { if (e.getState() == IdleState.READER_IDLE) { e.getChannel().write("heartbeat-reader_idle"); } else if (e.getState() == IdleState.WRITER_IDLE) { Logger.getLogger(IdleStateAwareHandler.class.getName()).log( Level.WARNING, "WriteIdle detected, closing channel"); e.getChannel().close(); e.getChannel().write("heartbeat-writer_idle"); } else if (e.getState() == IdleState.ALL_IDLE) { e.getChannel().write("heartbeat-all_idle"); } } }
/** * this case is like a read timeout where did not get anything from the * server for a long time. * * For UDP need to mark as error * * @see org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler#channelIdle * (org.jboss.netty.channel.ChannelHandlerContext, * org.jboss.netty.handler.timeout.IdleStateEvent) */ @Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { logger.debug("In IDLE event handler for UDP..timeout."); // there are 3 states. READER/WRITER/ALL if (e.getState() == IdleState.ALL_IDLE) { int statusCodeInt = 1; String statusCode = statusCodeInt + " FAILURE"; String errMsg = "UDP idle (read) timeout"; udpWorker.onComplete(udpWorker.responseSb.toString(), true, errMsg, errMsg, statusCode, statusCodeInt); } } }
@Override public void channelIdle(final ChannelHandlerContext ctx, final IdleStateEvent e) throws Exception { final OFMessage m = BasicFactory.getInstance().getMessage( OFType.ECHO_REQUEST); e.getChannel().write(Collections.singletonList(m)); }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { if (e.getState() == IdleState.WRITER_IDLE && enabledTimeout) { e.getChannel().close(); } } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (!isHandshakeComplete()) { return; } if (e.getState() == IdleState.READER_IDLE) { // When no message is received on channel for read timeout, then close // the channel log.info("Disconnecting client {} due to read timeout", getClientInfoString()); ctx.getChannel().close(); } else if (e.getState() == IdleState.WRITER_IDLE) { // Send keep alive message log.debug("Sending keep alive message due to IdleState timeout " + pc.toString()); pc.sendMessage(Collections.singletonList(pc.factory().buildKeepaliveMsg().build())); } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (e.getState() == IdleState.ALL_IDLE) { e.getChannel().close(); } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (!isHandshakeComplete()) { return; } if (e.getState() == IdleState.READER_IDLE) { // When no message is received on channel for read timeout, then close // the channel log.info("Disconnecting client {} due to read timeout", getClientInfoString()); ctx.getChannel().close(); } else if (e.getState() == IdleState.WRITER_IDLE) { // Send keep alive message log.debug("Sending keep alive message due to IdleState timeout " + pc.toString()); pc.sendMessage(Collections.singletonList(pc.factory().buildKeepaliveMsg().build())); } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { if (e.getState() == IdleState.WRITER_IDLE && enabledTimeout) { e.getChannel().close(); } } }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { // check if the client did nothing for too long if (e.getState().equals(IdleState.ALL_IDLE)) { ImapSession session = (ImapSession) attributes.get(ctx.getChannel()); InetSocketAddress address = (InetSocketAddress) ctx.getChannel().getRemoteAddress(); LOGGER.info("Logout client {} ({}) because it idled for too long...", address.getHostName(), address.getAddress().getHostAddress()); // logout the client session.logout(); // close the channel ctx.getChannel().close(); } super.channelIdle(ctx, e); }
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (e.getState() == IdleState.ALL_IDLE) { idle_connections_closed.increment(); LOG.info("Closing idle connection to HBase region server: " + e.getChannel()); // RegionClientPipeline's disconnect method will handle cleaning up // any outstanding RPCs and removing the client from caches try { e.getChannel().close(); } catch (Exception ex) { // This handler may be called after a channel has entered an odd state // or already been closed. If it has been closed properly, then ignore // the exception, otherwise throw it. if (!(ex instanceof ClosedChannelException)) { throw ex; } } } } }
public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { // just close idle connection if (e.getState() == IdleState.ALL_IDLE) { ChannelFuture future = ctx.getChannel().close(); future = future.await(); if (future.isSuccess()) { log.info("close idle connecton: client ip=>" + ctx.getChannel().getRemoteAddress()); } else { log.info("failure close idle connecton: client ip=>" + ctx.getChannel().getRemoteAddress()); } } } }