From 542efdc7c7eed1f7c937b9b59d80a0487f556057 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Sat, 26 Oct 2013 17:43:10 +0200 Subject: [PATCH] [#1812] All to have NioMessageUnsafe.read() inlined --- .../channel/nio/AbstractNioMessageChannel.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/nio/AbstractNioMessageChannel.java b/transport/src/main/java/io/netty/channel/nio/AbstractNioMessageChannel.java index 3a32c67f09..ac31e89c46 100644 --- a/transport/src/main/java/io/netty/channel/nio/AbstractNioMessageChannel.java +++ b/transport/src/main/java/io/netty/channel/nio/AbstractNioMessageChannel.java @@ -50,16 +50,19 @@ public abstract class AbstractNioMessageChannel extends AbstractNioChannel { private final List readBuf = new ArrayList(); + private void removeReadOp() { + SelectionKey key = selectionKey(); + int interestOps = key.interestOps(); + if ((interestOps & readInterestOp) != 0) { + // only remove readInterestOp if needed + key.interestOps(interestOps & ~readInterestOp); + } + } @Override public void read() { assert eventLoop().inEventLoop(); - final SelectionKey key = selectionKey(); if (!config().isAutoRead()) { - int interestOps = key.interestOps(); - if ((interestOps & readInterestOp) != 0) { - // only remove readInterestOp if needed - key.interestOps(interestOps & ~readInterestOp); - } + removeReadOp(); } final ChannelConfig config = config();