Log prematurly returning select() at DEBUG level and increase the minimum required consecutive premature returns to log

This commit is contained in:
Trustin Lee 2013-03-22 12:59:47 +09:00
parent d525295d20
commit 69e5a0eb9c

View File

@ -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 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; private static final int SELECTOR_AUTO_REBUILD_THRESHOLD;
// Workaround for JDK NIO bug. // Workaround for JDK NIO bug.
@ -77,7 +78,7 @@ public final class NioEventLoop extends SingleThreadEventLoop {
} }
int selectorAutoRebuildThreshold = SystemPropertyUtil.getInt("io.netty.selectorAutoRebuildThreshold", 16); int selectorAutoRebuildThreshold = SystemPropertyUtil.getInt("io.netty.selectorAutoRebuildThreshold", 16);
if (selectorAutoRebuildThreshold < 2) { if (selectorAutoRebuildThreshold < MIN_PREMATURE_SELECTOR_RETURNS) {
selectorAutoRebuildThreshold = 0; selectorAutoRebuildThreshold = 0;
} }
@ -625,9 +626,9 @@ public final class NioEventLoop extends SingleThreadEventLoop {
private void resetPrematureSelectorReturns() { private void resetPrematureSelectorReturns() {
int prematureSelectorReturns = this.prematureSelectorReturns; int prematureSelectorReturns = this.prematureSelectorReturns;
if (prematureSelectorReturns > 1) { if (prematureSelectorReturns >= MIN_PREMATURE_SELECTOR_RETURNS) {
if (logger.isWarnEnabled()) { if (logger.isDebugEnabled()) {
logger.warn("Selector.select() returned prematurely {} times in a row.", prematureSelectorReturns); logger.debug("Selector.select() returned prematurely {} times in a row.", prematureSelectorReturns);
} }
this.prematureSelectorReturns = 0; this.prematureSelectorReturns = 0;
} }