Netty Server配置多个入栈处理器时, 当一个终端断开连接, channelInactive和channelUnregistered方法会按照入栈处理器顺序只执行一次

@Override
public void channelInactive(ChannelHandlerContext ctx) throws Exception {
log.debug("channelInactive");
}

@Override
public void channelUnregistered(ChannelHandlerContext ctx) throws Exception {
log.debug("channelUnregistered");
}

注意: 只会在第一个写了该方法的入栈处理器执行, 排序管道后面的入栈处理器即使写了该方法, 也不再执行

20220705: 调用 ctx.pipeline().fireChannelInactive(); 可向下传递

posted @ 2022-07-04 15:30  阿祥爱骑车  阅读(789)  评论(0)    收藏  举报