diff --git a/transport/src/main/java/io/netty/channel/socket/oio/SingleBlockingChannelEventLoop.java b/transport/src/main/java/io/netty/channel/socket/oio/SingleBlockingChannelEventLoop.java index 8d51bacba3..32c42857f0 100644 --- a/transport/src/main/java/io/netty/channel/socket/oio/SingleBlockingChannelEventLoop.java +++ b/transport/src/main/java/io/netty/channel/socket/oio/SingleBlockingChannelEventLoop.java @@ -43,17 +43,12 @@ class SingleBlockingChannelEventLoop extends SingleThreadEventLoop { // Waken up by interruptThread() } } else { + processTaskQueue(); ch.unsafe().read(); - for (;;) { - Runnable task = pollTask(); - if (task == null) { - break; - } - task.run(); - } // Handle deregistration if (!ch.isRegistered()) { + processTaskQueue(); deregister(); } } @@ -64,6 +59,16 @@ class SingleBlockingChannelEventLoop extends SingleThreadEventLoop { } } + private void processTaskQueue() { + for (;;) { + Runnable task = pollTask(); + if (task == null) { + break; + } + task.run(); + } + } + @Override protected void wakeup(boolean inEventLoop) { interruptThread();