【发布时间】:2014-03-07 06:47:09
【问题描述】:
我正在阅读 Netty 频道的 Javadoc:http://netty.io/4.0/api/io/netty/channel/Channel.html
在我的单线程中(在Netty的IO线程之外),如果我多次调用Channel#write:
channel.write(msg1);
channel.write(msg2);
channel.write(msg3);
Netty 是否会确保消息按顺序输出:msg1、msg2、msg3? 还是我必须自己手动确保订单(非常繁琐,非常丑陋)?
ChannelFuture f1 = channel.write(msg1);
f1.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) {
ChannelFuture f2 = channel.write(msg2);
f2.addListener(new ChannelFutureListener() {
public void operationComplete(ChannelFuture future) {
channel.write(msg3);
}
});
}
});
【问题讨论】:
标签: netty