org.jboss.netty.handler.timeout.IdleState Java Examples
The following examples show how to use
org.jboss.netty.handler.timeout.IdleState.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ImapIdleStateHandler.java From james-project with Apache License 2.0 | 6 votes |
@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); }
Example #2
Source File: PcepChannelHandler.java From onos with Apache License 2.0 | 6 votes |
@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())); } }
Example #3
Source File: RpcProgramPortmap.java From hadoop with Apache License 2.0 | 5 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (e.getState() == IdleState.ALL_IDLE) { e.getChannel().close(); } }
Example #4
Source File: RpcProgramPortmap.java From big-c with Apache License 2.0 | 5 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (e.getState() == IdleState.ALL_IDLE) { e.getChannel().close(); } }
Example #5
Source File: TcpWorker.java From parallec with Apache License 2.0 | 5 votes |
@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); } }
Example #6
Source File: UdpWorker.java From parallec with Apache License 2.0 | 5 votes |
/** * 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); } }
Example #7
Source File: NettyAsyncHttpProvider.java From ck with Apache License 2.0 | 5 votes |
@Override protected void channelIdle(ChannelHandlerContext ctx, IdleState state, long lastActivityTimeMillis) throws Exception { NettyResponseFuture<?> future = (NettyResponseFuture<?>) ctx.getAttachment(); closeChannel(ctx); for (Entry<String,Channel> e: connectionsPool.entrySet()) { if (e.getValue().equals(ctx.getChannel())) { connectionsPool.remove(e.getKey()); activeConnectionsCount.decrementAndGet(); break; } } future.abort(new IOException("No response received. Connection timed out after " + config.getIdleConnectionTimeoutInMs())); }
Example #8
Source File: ImapHeartbeatHandler.java From james-project with Apache License 2.0 | 5 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { if (e.getState().equals(IdleState.WRITER_IDLE)) { e.getChannel().write(HEARTBEAT_BUFFER); } super.channelIdle(ctx, e); }
Example #9
Source File: TimeoutHandler.java From james-project with Apache License 2.0 | 4 votes |
@Override protected void channelIdle(ChannelHandlerContext ctx, IdleState state, long lastActivityTimeMillis) throws Exception { if (state.equals(IdleState.READER_IDLE)) { ctx.getChannel().close(); } }
Example #10
Source File: ShuffleHandler.java From tez with Apache License 2.0 | 4 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) { if (e.getState() == IdleState.WRITER_IDLE && enabledTimeout) { e.getChannel().close(); } }