下面列出了io.netty.channel.ChannelHandlerContext#fireChannelInactive ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@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();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
for (Integer streamId: spdySession.activeStreams().keySet()) {
removeStream(streamId, ctx.newSucceededFuture());
}
ctx.fireChannelInactive();
}
@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());
}*/
}
}
/**
* 服务端监听到客户端不活动
*
* @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();
}
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
if (!clientInitiatedClose) {
callback.onServerDisconnect();
}
LOG.info("Connection to the server is closed now.");
ctx.fireChannelInactive();
}
@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();
}
/**
* 服务端监听到客户端不活动
*
* @param ctx 连接context
* @throws Exception
*/
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
// 服务端接收到客户端掉线通知
Channel incoming = ctx.channel();
logger.debug("MessageServerHandler:" + incoming.remoteAddress() + "掉线");
ctx.fireChannelInactive();
}
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
channelCount.decrementAndGet();
allChannels.remove(ctx.channel());
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
if (DEBUG_CALLS) Gdx.app.debug(TAG, "channelInactive");
ctx.fireChannelInactive();
}
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
LOGGER.debug(logIdent(ctx, endpoint) + "Channel Inactive.");
endpoint.notifyChannelInactive();
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
doFlush(ctx);
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelInactive();
}
@Override
public void channelInactive(final ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
readState = ReadState.Closed;
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
stop();
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ChannelManager.getInstance().removeChannel(ctx.channel());
ctx.fireChannelInactive();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
ctx.fireChannelInactive();
timerMap.remove(ctx).stop();
}
@Override
public void channelInactive(ChannelHandlerContext ctx) {
failAndResetUserPromise(new ClosedChannelException());
ctx.fireChannelInactive();
}