A little bit of optimization that reduces interestOps() calls
This commit is contained in:
parent
488e56a9b1
commit
a7b5d45bdf
@ -141,8 +141,10 @@ public final class NioEventLoop extends SingleThreadEventLoop {
|
||||
|
||||
SelectionKey key = channel.selectionKey();
|
||||
channel.writableTasks.offer(task);
|
||||
if (!key.isWritable()) {
|
||||
key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
|
||||
|
||||
int interestOps = key.interestOps();
|
||||
if ((interestOps & SelectionKey.OP_WRITE) == 0) {
|
||||
key.interestOps(interestOps | SelectionKey.OP_WRITE);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user