From 69e5a0eb9c21969a91c07dc3f4c8cc2be1def8ec Mon Sep 17 00:00:00 2001 From: Trustin Lee Date: Fri, 22 Mar 2013 12:59:47 +0900 Subject: [PATCH] Log prematurly returning select() at DEBUG level and increase the minimum required consecutive premature returns to log --- .../src/main/java/io/netty/channel/nio/NioEventLoop.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java b/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java index 0498e1767d..96cf3db84c 100644 --- a/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java +++ b/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java @@ -56,6 +56,7 @@ public final class NioEventLoop extends SingleThreadEventLoop { private static final int CLEANUP_INTERVAL = 256; // XXX Hard-coded value, but won't need customization. + private static final int MIN_PREMATURE_SELECTOR_RETURNS = 3; private static final int SELECTOR_AUTO_REBUILD_THRESHOLD; // Workaround for JDK NIO bug. @@ -77,7 +78,7 @@ public final class NioEventLoop extends SingleThreadEventLoop { } int selectorAutoRebuildThreshold = SystemPropertyUtil.getInt("io.netty.selectorAutoRebuildThreshold", 16); - if (selectorAutoRebuildThreshold < 2) { + if (selectorAutoRebuildThreshold < MIN_PREMATURE_SELECTOR_RETURNS) { selectorAutoRebuildThreshold = 0; } @@ -625,9 +626,9 @@ public final class NioEventLoop extends SingleThreadEventLoop { private void resetPrematureSelectorReturns() { int prematureSelectorReturns = this.prematureSelectorReturns; - if (prematureSelectorReturns > 1) { - if (logger.isWarnEnabled()) { - logger.warn("Selector.select() returned prematurely {} times in a row.", prematureSelectorReturns); + if (prematureSelectorReturns >= MIN_PREMATURE_SELECTOR_RETURNS) { + if (logger.isDebugEnabled()) { + logger.debug("Selector.select() returned prematurely {} times in a row.", prematureSelectorReturns); } this.prematureSelectorReturns = 0; }