List of usage examples for io.netty.channel ChannelHandlerContext fireChannelInactive
@Override ChannelHandlerContext fireChannelInactive();
From source file:org.apache.hadoop.hbase.security.SaslUnwrapHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { SaslUtil.safeDispose(saslClient);//from w w w . j a v a2 s . c o m ctx.fireChannelInactive(); }
From source file:org.dcache.xrootd.plugins.AccessLogHandler.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { NetLoggerBuilder log = new NetLoggerBuilder(INFO, "org.dcache.xrootd.connection.end").omitNullValues(); log.add("session", CDC.getSession()); log.toLogger(logger);//from w w w .j ava 2 s .c o m ctx.fireChannelInactive(); }
From source file:org.dcache.xrootd.stream.ChunkedResponseWriteHandler.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { doFlush(ctx); ctx.fireChannelInactive(); }
From source file:org.eclipse.moquette.server.netty.MoquetteIdleTimoutHandler.java
License:Open Source License
@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();// w w w . jav a2s . c o m } /*else if (e.getState() == IdleState.WRITER_IDLE) { ctx.writeAndFlush(new PingMessage()); }*/ } }
From source file:org.iotivity.cloud.base.protocols.coap.CoapLogHandler.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { ctx.fireChannelInactive(); Log.v(ctx.channel().id().asLongText().substring(26) + " Disconnected, Address: " + ctx.channel().remoteAddress().toString()); }
From source file:org.iotivity.cloud.base.protocols.coap.websocket.WebSocketFrameHandler.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { Log.v(ctx.channel().id().asLongText().substring(26) + " WebSocket Disconnected, Address: " + ctx.channel().remoteAddress().toString()); ctx.fireChannelInactive(); }
From source file:org.iotivity.cloud.base.protocols.http.HttpLogHandler.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { Log.v(ctx.channel().id().asLongText().substring(26) + " HTTP Disconnected, Address: " + ctx.channel().remoteAddress().toString()); ctx.fireChannelInactive(); }
From source file:org.jpos.qrest.RestSession.java
License:Open Source License
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) { if (evt instanceof IdleStateEvent) { IdleState e = ((IdleStateEvent) evt).state(); if (e == IdleState.READER_IDLE) { server.getLog().info("timeout " + ctx.channel()); ctx.fireChannelInactive(); ctx.close();/* w ww. j av a2 s .c o m*/ } } }
From source file:org.jupiter.transport.netty.handler.connector.ConnectionWatchdog.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { boolean doReconnect = isReconnectNeeded(); if (doReconnect) { if (attempts < 12) { attempts++;/* w w w . ja v a 2 s .c o m*/ } long timeout = 2 << attempts; timer.newTimeout(this, timeout, TimeUnit.MILLISECONDS); } logger.warn("Disconnects with {}, address: {}, reconnect: {}.", ctx.channel(), remoteAddress, doReconnect); ctx.fireChannelInactive(); }
From source file:org.opendaylight.controller.netconf.nettyutil.handler.ssh.client.AsyncSshHandler.java
License:Open Source License
@Override public synchronized void disconnect(final ChannelHandlerContext ctx, final ChannelPromise promise) { LOG.trace("Closing SSH session on channel: {} with connect promise in state: {}", ctx.channel(), connectPromise);/*from w w w. java 2s .c o m*/ // If we have already succeeded and the session was dropped after, we need to fire inactive to notify reconnect logic if (connectPromise.isSuccess()) { ctx.fireChannelInactive(); } if (sshWriteAsyncHandler != null) { sshWriteAsyncHandler.close(); } if (sshReadAsyncListener != null) { sshReadAsyncListener.close(); } if (session != null && !session.isClosed() && !session.isClosing()) { session.close(false).addListener(new SshFutureListener<CloseFuture>() { @Override public void operationComplete(final CloseFuture future) { if (future.isClosed() == false) { session.close(true); } session = null; } }); } // Super disconnect is necessary in this case since we are using NioSocketChannel and it needs to cleanup its resources // e.g. Socket that it tries to open in its constructor (https://bugs.opendaylight.org/show_bug.cgi?id=2430) // TODO better solution would be to implement custom ChannelFactory + Channel that will use mina SSH lib internally: port this to custom channel implementation try { // Disconnect has to be closed after inactive channel event was fired, because it interferes with it super.disconnect(ctx, ctx.newPromise()); } catch (final Exception e) { LOG.warn("Unable to cleanup all resources for channel: {}. Ignoring.", ctx.channel(), e); } channel = null; promise.setSuccess(); LOG.debug("SSH session closed on channel: {}", ctx.channel()); }