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

The following examples show how to use io.netty.channel.ChannelHandlerContext#fireChannelInactive() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
@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 Project: netty-4.1.22   File: SpdySessionHandler.java    License: 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 3
@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 4
Source Project: sctalk   File: MessageServerHandler.java    License: 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 5
@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 6
@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 7
/**
 * 服务端监听到客户端不活动
 * 
 * @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 8
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelInactive();
}
 
Example 9
Source Project: xio   File: ChannelStatistics.java    License: 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();
}
 
Example 10
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  if (DEBUG_CALLS) Gdx.app.debug(TAG, "channelInactive");
  ctx.fireChannelInactive();
}
 
Example 11
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
    LOGGER.debug(logIdent(ctx, endpoint) + "Channel Inactive.");
    endpoint.notifyChannelInactive();
    ctx.fireChannelInactive();
}
 
Example 12
Source Project: xio   File: XioResponseClassifier.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
  ctx.fireChannelInactive();
}
 
Example 13
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    doFlush(ctx);
    ctx.fireChannelInactive();
}
 
Example 14
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelInactive();
}
 
Example 15
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
    ctx.fireChannelInactive();
}
 
Example 16
@Override
public void channelInactive(ChannelHandlerContext ctx) {
    readState = ReadState.Closed;
    ctx.fireChannelInactive();
}
 
Example 17
@Override
public void channelInactive(ChannelHandlerContext ctx) {
    stop();
    ctx.fireChannelInactive();
}
 
Example 18
Source Project: brpc-java   File: RpcServerHandler.java    License: 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 19
Source Project: xrpc   File: ServiceRateLimiter.java    License: 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 20
Source Project: bazel   File: AbstractHttpHandler.java    License: Apache License 2.0 4 votes vote down vote up
@Override
public void channelInactive(ChannelHandlerContext ctx) {
  failAndResetUserPromise(new ClosedChannelException());
  ctx.fireChannelInactive();
}