List of usage examples for io.netty.channel ChannelHandlerContext fireChannelInactive
@Override ChannelHandlerContext fireChannelInactive();
From source file:com.linkedin.r2.transport.http.client.RAPStreamResponseHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { // XXX this seems a bit odd, but if the channel closed before downstream layers received a response, we // have to deal with that ourselves (it does not get turned into an exception by downstream // layers, even though some other protocol errors do) TransportCallback<StreamResponse> callback = ctx.channel().attr(CALLBACK_ATTR_KEY).getAndRemove(); if (callback != null) { LOG.debug("{}: active channel closed", ctx.channel().remoteAddress()); callback.onResponse(TransportResponseImpl.<StreamResponse>error(new ClosedChannelException(), Collections.<String, String>emptyMap())); } else {/* w w w.ja va2 s. c o m*/ LOG.debug("{}: potentially idle channel closed", ctx.channel().remoteAddress()); } ctx.fireChannelInactive(); }
From source file:com.xmpp.push.androidpn.server.xmpp.handler.XMPPHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (LOG.isDebugEnabled()) LOG.debug("channel ctx=[{}] disconnected.", ctx); connectManager.removeConnect(ctx.channel().id().asLongText()); ctx.fireChannelInactive(); }
From source file:com.xx_dev.apn.proxy.ApnProxyRelayHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { LoggerUtil.debug(logger, ctx.channel().attr(ApnProxyConnectionAttribute.ATTRIBUTE_KEY), tag, "channel inactive"); if (relayChannel != null && relayChannel.isActive()) { relayChannel.writeAndFlush(Unpooled.EMPTY_BUFFER).addListener(ChannelFutureListener.CLOSE); }//from ww w. j av a 2 s . co m ctx.fireChannelInactive(); }
From source file:com.xx_dev.apn.proxy.ApnProxyRemoteForwardHandler.java
License:Apache License
@Override public void channelInactive(final ChannelHandlerContext remoteChannelCtx) throws Exception { LoggerUtil.debug(logger, uaChannel.attr(ApnProxyConnectionAttribute.ATTRIBUTE_KEY), "Remote channel inactive"); final String remoteAddr = uaChannel.attr(ApnProxyConnectionAttribute.ATTRIBUTE_KEY).get().getRemote() .getRemoteAddr();//ww w . ja v a 2s .c om remoteChannelInactiveCallback.remoteChannelInactive(uaChannel, remoteAddr); remoteChannelCtx.fireChannelInactive(); }
From source file:de.saxsys.synchronizefx.netty.base.client.NetworkEventHandlerClient.java
License:Open Source License
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { if (!clientInitiatedClose) { callback.onServerDisconnect();//from www .j a va2 s. c om } LOG.info("Connection to the server is closed now."); ctx.fireChannelInactive(); }
From source file:de.saxsys.synchronizefx.netty.base.server.NetworkEventHandlerServer.java
License:Open Source License
@Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { LOG.info("The connection to client with the address" + ctx.channel().remoteAddress() + " was closed."); ctx.fireChannelInactive(); }
From source file:divconq.net.ByteToMessageDecoder.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { RecyclableArrayList out = RecyclableArrayList.newInstance(); try {/*from www . jav a2 s .co m*/ if (this.cumulation != null) { callDecode(ctx, this.cumulation, out); decodeLast(ctx, this.cumulation, out); } else { decodeLast(ctx, Unpooled.EMPTY_BUFFER, out); } } catch (DecoderException e) { throw e; } catch (Exception e) { throw new DecoderException(e); } finally { try { if (this.cumulation != null) { this.cumulation.release(); this.cumulation = null; } int size = out.size(); for (int i = 0; i < size; i++) { ctx.fireChannelRead(out.get(i)); } if (size > 0) { // Something was read, call fireChannelReadComplete() ctx.fireChannelReadComplete(); } ctx.fireChannelInactive(); } finally { // recycle in all cases out.recycle(); } } }
From source file:io.crate.mqtt.netty.MqttMessageLogger.java
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { String clientID = NettyUtils.clientID(ctx.channel()); if (clientID != null && !clientID.isEmpty() && logger.isTraceEnabled()) { logger.trace("Channel closed <{}>", clientID); }//from www. j av a2s. com ctx.fireChannelInactive(); }
From source file:io.crate.mqtt.netty.MqttNettyIdleTimeoutHandler.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 ww. j av a2s .c om } } else { super.userEventTriggered(ctx, evt); } }
From source file:io.moquette.server.netty.metrics.DropWizardMetricsHandler.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { String clientID = NettyUtils.clientID(ctx.channel()); if (clientID != null && !clientID.isEmpty()) { this.connectedClientsMetrics.dec(); }//from w w w . j av a 2s . c o m ctx.fireChannelInactive(); }