Netty:writeAndFlush通道未来侦听器回调何时执行?

mar*_*ner 4 callback netty

我是 netty 的新手,并试图了解 writeAndFlush 的通道未来如何工作。考虑在 netty 客户端上运行的以下代码:

final ChannelFuture writeFuture = abacaChannel.writeAndFlush("Test");
writeFuture.addListener(new ChannelFutureListener() {
    @Override
    public void operationComplete(ChannelFuture future) throws Exception {
        if (writeFuture.isSuccess()) {
            LOGGER.debug("Write successful");
        } else {
            LOGGER.error("Error writing message to Abaca host");
        }
    }
});
Run Code Online (Sandbox Code Playgroud)

这个writeFuture操作完成回调什么时候执行?

  1. netty将数据交给OS发送缓冲区(或)之后

  2. 操作系统将数据写入网络套接字后。(或者)

  3. 服务器实际收到此数据后。

TIA

lou*_*xiu 5

1. After netty hands over the data to the OS send buffers (or)
Run Code Online (Sandbox Code Playgroud)

从(netty的发送缓冲区)data中删除后监听器将收到通知ChannelOutboundBuffer