Java Code Examples for io.netty.channel.ChannelHandlerContext#fireChannelInactive()

The following examples show how to use io.netty.channel.ChannelHandlerContext#fireChannelInactive() . 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: ServerConnectionStateNotifier.java    From openAGV with Apache License 2.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) {
    if (connectionEventListener != null) {
        LOG.debug("Disconnecting channel for key: '{}'.", key);
        ClientEntry entry = clientEntries.get(key);
        if (entry != null) {
            entry.setChannel(null);
        }
        connectionEventListener.onDisconnect();
    }
    ctx.fireChannelInactive();
}
 
Example 2
Source File: ClientMessageClientHandler.java    From sctalk with Apache License 2.0 5 votes vote down vote up
/**
 * 服务端监听到客户端不活动
 * 
 * @param ctx 连接context
 * @throws Exception
 */
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    // 服务端接收到客户端掉线通知
    Channel incoming = ctx.channel();
    logger.debug("MessageServerHandler:" + incoming.remoteAddress() + "掉线");
    ctx.fireChannelInactive();
}
 
Example 3
Source File: SpdySessionHandler.java    From netty-4.1.22 with Apache License 2.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    for (Integer streamId: spdySession.activeStreams().keySet()) {
        removeStream(streamId, ctx.newSucceededFuture());
    }
    ctx.fireChannelInactive();
}
 
Example 4
Source File: MoquetteIdleTimeoutHandler.java    From cloud-pubsub-mqtt-proxy with Apache License 2.0 5 votes vote down vote up
@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();
    } /*else if (e.getState() == IdleState.WRITER_IDLE) {
        ctx.writeAndFlush(new PingMessage());
    }*/
  }
}
 
Example 5
Source File: ClientHandler.java    From LuckyFrameClient with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) {
    log.info("�����ѶϿ������ڳ�������...");
    //ʹ�ù����ж�������
    final EventLoop eventLoop = ctx.channel().eventLoop();
    eventLoop.schedule(() -> {
        try {
            NettyClient.start();
        } catch (Exception e) {
            log.error("���ӳ����쳣�����ڳ�������...",e);
        }
    }, 1, TimeUnit.SECONDS);

    ctx.fireChannelInactive();
}
 
Example 6
Source File: MessageServerHandler.java    From sctalk with Apache License 2.0 5 votes vote down vote up
/**
 * 服务端监听到客户端不活动
 * 
 * @param ctx 连接context
 * @throws Exception
 */
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    // 服务端接收到客户端掉线通知
    Channel incoming = ctx.channel();
    logger.debug("MessageServerHandler:" + incoming.remoteAddress() + "掉线");
    handlerManager.offline(ctx);
    ctx.fireChannelInactive();
}
 
Example 7
Source File: NetworkEventHandlerClient.java    From SynchronizeFX with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
    if (!clientInitiatedClose) {
        callback.onServerDisconnect();
    }
    LOG.info("Connection to the server is closed now.");
    ctx.fireChannelInactive();
}
 
Example 8
Source File: ExceptionHandlerFilter.java    From spring-boot-netty with MIT License 4 votes vote down vote up
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelInactive();
}
 
Example 9
Source File: AbstractHttpHandler.java    From bazel with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) {
  failAndResetUserPromise(new ClosedChannelException());
  ctx.fireChannelInactive();
}
 
Example 10
Source File: ServiceRateLimiter.java    From xrpc with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  ctx.fireChannelInactive();

  timerMap.remove(ctx).stop();
}
 
Example 11
Source File: RpcServerHandler.java    From brpc-java with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    ChannelManager.getInstance().removeChannel(ctx.channel());
    ctx.fireChannelInactive();
}
 
Example 12
Source File: Http2PingHandler.java    From aws-sdk-java-v2 with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) {
    stop();
    ctx.fireChannelInactive();
}
 
Example 13
Source File: WampServerWebsocketHandler.java    From GreenBits with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) {
    readState = ReadState.Closed;
    ctx.fireChannelInactive();
}
 
Example 14
Source File: ExceptionChannelHandler.java    From journalkeeper with Apache License 2.0 4 votes vote down vote up
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelInactive();
}
 
Example 15
Source File: WampClientWebsocketHandler.java    From jawampa with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelInactive();
}
 
Example 16
Source File: ChunkedWriteHandler.java    From netty4.0.27Learn with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    doFlush(ctx);
    ctx.fireChannelInactive();
}
 
Example 17
Source File: XioResponseClassifier.java    From xio with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  ctx.fireChannelInactive();
}
 
Example 18
Source File: AbstractGenericHandler.java    From couchbase-jvm-core with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
    LOGGER.debug(logIdent(ctx, endpoint) + "Channel Inactive.");
    endpoint.notifyChannelInactive();
    ctx.fireChannelInactive();
}
 
Example 19
Source File: EndpointedChannelHandler.java    From riiablo with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  if (DEBUG_CALLS) Gdx.app.debug(TAG, "channelInactive");
  ctx.fireChannelInactive();
}
 
Example 20
Source File: ChannelStatistics.java    From xio with Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  channelCount.decrementAndGet();
  allChannels.remove(ctx.channel());
  ctx.fireChannelInactive();
}