List of usage examples for io.netty.channel ChannelHandlerContext fireChannelInactive
@Override ChannelHandlerContext fireChannelInactive();
From source file:com.couchbase.client.core.endpoint.GenericEndpointHandler.java
License:Open Source License
/** * Notify the endpoint if the channel is inactive now. * * This is important as the upper endpoint needs to coordinate the reconnect process. * * @param ctx the channel handler context. * @throws Exception if something goes wrong while setting the channel inactive. *//*from ww w .ja va2s . c o m*/ @Override public void channelInactive(final ChannelHandlerContext ctx) throws Exception { endpoint.notifyChannelInactive(); ctx.fireChannelInactive(); }
From source file:com.ebay.jetstream.messaging.transport.netty.autoflush.handler.NettyAutoFlushBatcher.java
License:MIT License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { AutoFlushWriterChannelQueue queue = m_channelQueue.remove(ctx.channel()); if (queue == null) { ctx.fireChannelInactive(); return;/* ww w. ja va 2s . c o m*/ } MessageEvent[] events = queue.get(); if (events == null) { ctx.fireChannelInactive(); return; } Throwable cause = new ClosedChannelException(); for (int i = 0; i < events.length; i++) { MessageEvent ev = events[i]; Promise promise = ev.getPromise(); if (promise != null) promise.setFailure(cause); ((ByteBuf) ev.getMsg()).release(); } if (queue != null) { queue.clear(); } ctx.fireChannelInactive(); }
From source file:com.ebay.jetstream.messaging.transport.netty.eventproducer.EventConsumerSessionHandler.java
License:MIT License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { String message = "Channel Inactive "; message += " - "; message += ((InetSocketAddress) ctx.channel().remoteAddress()).getAddress().getHostAddress(); if (ctx.channel().isActive()) ctx.channel().close();// w w w. jav a 2 s . c o m LOGGER.warn(message); m_ep.removeSession(ctx); ctx.fireChannelInactive(); }
From source file:com.farsunset.cim.sdk.android.filter.CIMLoggingHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (debug) {/*w w w. j a v a2 s. c om*/ Log.i(TAG, "CLOSED" + getSessionInfo(ctx.channel())); } ctx.fireChannelInactive(); }
From source file:com.github.nettybook.ch0.LoggingHandler.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (logger.isEnabled(internalLevel)) { logger.log(internalLevel, format(ctx, "INACTIVE")); }//w w w. j a v a2 s . c o m ctx.fireChannelInactive(); }
From source file:com.google.cloud.pubsub.proxy.moquette.MoquetteIdleTimeoutHandler.java
License:Open Source License
@Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof IdleStateEvent) { IdleState state = ((IdleStateEvent) evt).state(); if (state == IdleState.ALL_IDLE) { //fire a channelInactive to trigger publish of Will ctx.fireChannelInactive(); ctx.close();//from www . ja va 2 s . c o m } /*else if (e.getState() == IdleState.WRITER_IDLE) { ctx.writeAndFlush(new PingMessage()); }*/ } }
From source file:com.google.devtools.build.lib.remote.blobstore.http.AbstractHttpHandler.java
License:Open Source License
@Override public void channelInactive(ChannelHandlerContext ctx) { failAndResetUserPromise(new ClosedChannelException()); ctx.fireChannelInactive(); }
From source file:com.linecorp.armeria.client.Http1ResponseDecoder.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { if (res != null) { res.close(ClosedSessionException.get()); }// w w w . j av a 2 s .com ctx.fireChannelInactive(); }
From source file:com.linkedin.r2.transport.http.client.RAPResponseDecoder.java
License:Apache License
@Override public void channelInactive(ChannelHandlerContext ctx) throws Exception { Timeout<None> timeout = ctx.channel().attr(TIMEOUT_ATTR_KEY).getAndRemove(); if (timeout != null) { timeout.getItem();//from w w w .j a va 2 s .co m } if (_chunkedMessageWriter != null) { _chunkedMessageWriter.fail(new ClosedChannelException()); _chunkedMessageWriter = null; } ctx.fireChannelInactive(); }
From source file:com.linkedin.r2.transport.http.client.RAPResponseHandler.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<RestResponse> callback = ctx.channel().attr(CALLBACK_ATTR_KEY).getAndRemove(); if (callback != null) { LOG.debug("{}: active channel closed", ctx.channel().remoteAddress()); callback.onResponse(TransportResponseImpl.<RestResponse>error(new ClosedChannelException(), Collections.<String, String>emptyMap())); } else {//from w ww . j av a2s .co m LOG.debug("{}: idle channel closed", ctx.channel().remoteAddress()); } ctx.fireChannelInactive(); }