List of usage examples for io.netty.channel ChannelHandlerContext fireChannelInactive
@Override ChannelHandlerContext fireChannelInactive();
From source file:io.moquette.server.netty.metrics.MQTTMessageLogger.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { String clientID = NettyUtils.clientID(ctx.channel()); if (clientID != null && !clientID.isEmpty()) { LOG.info("Channel closed <{}>", clientID); }//from ww w. ja v a 2 s . c o m ctx.fireChannelInactive(); }
From source file:io.netlibs.bgp.netty.handlers.BGPv4ClientEndpoint.java
License:Apache License
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { log.info("disconnected from client " + ctx.channel().remoteAddress()); final BGPv4FSM fsm = this.fsmRegistry.lookupFSM((InetSocketAddress) ctx.channel().remoteAddress()); if (fsm == null) { log.error("Internal Error: client for address " + ctx.channel().remoteAddress() + " is unknown"); ctx.channel().close();//from w ww .j av a2s . c o m } else { fsm.handleDisconnected(ctx.channel()); ctx.fireChannelInactive(); } }
From source file:io.netty.example.ocsp.OcspClientExample.java
License:Apache License
private static ChannelInitializer<Channel> newClientHandler(final ReferenceCountedOpenSslContext context, final String host, final Promise<FullHttpResponse> promise) { return new ChannelInitializer<Channel>() { @Override/*from w w w .j av a 2 s . com*/ protected void initChannel(Channel ch) throws Exception { SslHandler sslHandler = context.newHandler(ch.alloc()); ReferenceCountedOpenSslEngine engine = (ReferenceCountedOpenSslEngine) sslHandler.engine(); ChannelPipeline pipeline = ch.pipeline(); pipeline.addLast(sslHandler); pipeline.addLast(new ExampleOcspClientHandler(engine)); pipeline.addLast(new HttpClientCodec()); pipeline.addLast(new HttpObjectAggregator(1024 * 1024)); pipeline.addLast(new HttpClientHandler(host, promise)); } @Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (!promise.isDone()) { promise.tryFailure(new IllegalStateException("Connection closed and Promise was not done.")); } ctx.fireChannelInactive(); } @Override public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception { if (!promise.tryFailure(cause)) { ctx.fireExceptionCaught(cause); } } }; }
From source file:jgnash.engine.attachment.NettyTransferHandler.java
License:Open Source License
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { for (Attachment object : fileMap.values()) { try {/*w w w. ja v a 2s . co m*/ object.fileOutputStream.close(); } catch (IOException e) { logger.log(Level.SEVERE, e.getLocalizedMessage(), e); } } ctx.fireChannelInactive(); // forward to the next handler in the pipeline }
From source file:org.apache.cassandra.transport.ConnectionLimitHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { counter.decrementAndGet();/*from w w w . j a va 2 s . co m*/ InetAddress address = ((InetSocketAddress) ctx.channel().remoteAddress()).getAddress(); AtomicLong count = connectionsPerClient.get(address); if (count != null) { if (count.decrementAndGet() <= 0) { connectionsPerClient.remove(address); } } ctx.fireChannelInactive(); }
From source file:org.apache.flink.runtime.io.network.netty.PartitionRequestQueue.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { releaseAllResources();/*from w w w . j a v a 2 s . co m*/ ctx.fireChannelInactive(); }
From source file:org.apache.giraph.comm.netty.handler.RequestServerHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("channelInactive: Closed the channel on " + ctx.channel().remoteAddress()); }//w w w .j a va2 s . co m ctx.fireChannelInactive(); }
From source file:org.apache.giraph.comm.netty.handler.ResponseClientHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (LOG.isDebugEnabled()) { LOG.debug("channelClosed: Closed the channel on " + ctx.channel().remoteAddress()); }/*from ww w . j a v a2 s. c o m*/ ctx.fireChannelInactive(); }
From source file:org.apache.hadoop.hbase.ipc.NettyRpcDuplexHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (!id2Call.isEmpty()) { cleanupCalls(ctx, new IOException("Connection closed")); }/*from w w w. j a va 2 s. c o m*/ conn.shutdown(); ctx.fireChannelInactive(); }
From source file:org.apache.hadoop.hbase.security.NettyHBaseSaslRpcClientHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { saslRpcClient.dispose();/*from w ww . j av a2 s . c om*/ saslPromise.tryFailure(new IOException("Connection closed")); ctx.fireChannelInactive(); }