Allow disabling automatic selector rebuilding by specifing non-positive threshold

This commit is contained in:
Trustin Lee 2013-03-22 11:50:53 +09:00
parent 1ab2813405
commit f6e0df125a

View File

@ -573,7 +573,9 @@ public final class NioEventLoop extends SingleThreadEventLoop {
if (System.nanoTime() - startTimeNanos < delayNanos >>> 1) { if (System.nanoTime() - startTimeNanos < delayNanos >>> 1) {
// Returned way before the specified timeout with no selected keys. // Returned way before the specified timeout with no selected keys.
// This may be because of the JDK /dev/epoll bug - increment the counter. // This may be because of the JDK /dev/epoll bug - increment the counter.
if (++ prematureSelectorReturns >= SELECTOR_AUTO_REBUILD_THRESHOLD) { prematureSelectorReturns ++;
if (SELECTOR_AUTO_REBUILD_THRESHOLD > 0 &&
prematureSelectorReturns >= SELECTOR_AUTO_REBUILD_THRESHOLD) {
// The selector returned prematurely many times in a row. // The selector returned prematurely many times in a row.
// Rebuild the selector to work around the problem. // Rebuild the selector to work around the problem.
logger.warn( logger.warn(