我的程序中有这段代码:
ChannelFuture future = channel.write(msg);
future.addListener(new ChannelFutureListener() {
@Override
public void operationComplete(ChannelFuture future) {
System.out.println("wrote ");
}
});
System.out.println("done ");
首先执行的操作:System.out.println(“write”);或System.out.println(“完成”); ?
答案 0 :(得分:1)
这取决于写入的速度。如果在添加监听器之前写入完成,它将首先打印“已写入”。否则“完成”......