From 058dfd0a78214c794cfaad39f25a5c43f7587b78 Mon Sep 17 00:00:00 2001 From: norman Date: Thu, 13 Sep 2012 10:25:59 +0200 Subject: [PATCH] Just add a comment to show that the code is related to #597 --- .../main/java/io/netty/channel/socket/nio/NioEventLoop.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java b/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java index e8c643b224..113db6d8b9 100644 --- a/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java +++ b/transport/src/main/java/io/netty/channel/socket/nio/NioEventLoop.java @@ -253,6 +253,9 @@ final class NioEventLoop extends SingleThreadEventLoop { private void processSelectedKeys() { Set selectedKeys = selector.selectedKeys(); + // check if the set is empty and if so just return to not create garbage by + // creating a new Iterator every time even if there is nothing to process. + // See https://github.com/netty/netty/issues/597 if (selectedKeys.isEmpty()) { return; }