Netty Channel.isWritable 返回 false
在 Netty 里,有4个方法用来查询 Channel 的状态:isOpen,isRegistered,isActive,isWritable,其中,isWritable 在并发量很高时会返回很多 false。
isWritable 是什么含义?
isWritable:Returns true if and only if the I/O thread will perform the requested write operation immediately. Any write requests made when this method returns false are queued until the I/O thread is ready to process the queued write requests.
为什么 isWritable 会返回 false?而且这个问题在 stackoverflow,netty 社区也被很多人问到。
i.e.
if (channel.isWritable()) {
channel.writeAndFlush(data);
}
This chapter requires login to view full content. You are viewing a preview.
Login to View Full Content