From 418550914a8bb01a7eae060f89244ad32bf39318 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 9 Jun 2016 09:28:47 +0200 Subject: [PATCH] Log Selector instance when Selector needs to be rebuild Motivation: To better debug why a Selector need to be rebuild it is useful to also log the instance of the Selector. Modifications: Add logger instance to the log message. Result: More useful log message. --- .../main/java/io/netty/channel/nio/NioEventLoop.java | 10 ++++++---- 1 file changed, 6 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 806dcccd88..c69f8f6fab 100644 --- a/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java +++ b/transport/src/main/java/io/netty/channel/nio/NioEventLoop.java @@ -715,8 +715,8 @@ public final class NioEventLoop extends SingleThreadEventLoop { // The selector returned prematurely many times in a row. // Rebuild the selector to work around the problem. logger.warn( - "Selector.select() returned prematurely {} times in a row; rebuilding selector.", - selectCnt); + "Selector.select() returned prematurely {} times in a row; rebuilding Selector {}.", + selectCnt, selector); rebuildSelector(); selector = this.selector; @@ -732,12 +732,14 @@ public final class NioEventLoop extends SingleThreadEventLoop { if (selectCnt > MIN_PREMATURE_SELECTOR_RETURNS) { if (logger.isDebugEnabled()) { - logger.debug("Selector.select() returned prematurely {} times in a row.", selectCnt - 1); + logger.debug("Selector.select() returned prematurely {} times in a row for Selector {}.", + selectCnt - 1, selector); } } } catch (CancelledKeyException e) { if (logger.isDebugEnabled()) { - logger.debug(CancelledKeyException.class.getSimpleName() + " raised by a Selector - JDK bug?", e); + logger.debug(CancelledKeyException.class.getSimpleName() + " raised by a Selector {} - JDK bug?", + selector, e); } // Harmless exception - log anyway }