org.jboss.netty.handler.timeout.IdleStateEvent Java Examples
The following examples show how to use
org.jboss.netty.handler.timeout.IdleStateEvent.
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: AbstractRPCChannelHandler.java From floodlight_with_topoguard with Apache License 2.0 | 5 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { // send an echo request EchoRequestMessage m = new EchoRequestMessage(); AsyncMessageHeader header = new AsyncMessageHeader(); header.setTransactionId(getTransactionId()); m.setHeader(header); SyncMessage bsm = new SyncMessage(MessageType.ECHO_REQUEST); bsm.setEchoRequest(m); ctx.getChannel().write(bsm); }
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: FpmSessionHandler.java From onos with Apache License 2.0 | 5 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { log.warn("FPM channel idle"); if (useKeepalives) { ctx.getChannel().close(); } super.channelIdle(ctx, e); }
Example #10
Source File: IdleChannelWatchdog.java From zuul-netty with Apache License 2.0 | 5 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { LOG.info("closing {} channel after {} event was intercepted", channelName, e.getState().toString()); e.getChannel().close().addListener(new ChannelFutureListener() { @Override public void operationComplete(ChannelFuture future) throws Exception { if (future.isSuccess()) { LOG.info("{} channel closed cleanly", channelName); } else { LOG.info("{} channel failed to close cleanly", channelName); } } }); }
Example #11
Source File: OFChannelHandler.java From floodlight_with_topoguard with Apache License 2.0 | 4 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { OFMessage m = BasicFactory.getInstance().getMessage(OFType.ECHO_REQUEST); e.getChannel().write(Collections.singletonList(m)); }
Example #12
Source File: OFControllerChannelHandler.java From FlowSpaceFirewall with Apache License 2.0 | 4 votes |
@Override public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e) throws Exception { OFMessage m = BasicFactory.getInstance().getMessage(OFType.ECHO_REQUEST); e.getChannel().write(Collections.singletonList(m)); }
Example #13
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(); } }