From 1405c2a99f0997ac3192529223f56eb0d1cb29e8 Mon Sep 17 00:00:00 2001 From: Vassilis Bekiaris Date: Fri, 22 Oct 2021 17:30:07 +0300 Subject: [PATCH] Rephrase log message for selector rebuild (#19761) When executing with selectwithfix, log the first encounter of selector rebuild as a WARNING, then continue logging at FINE level. --- .../com/hazelcast/internal/networking/nio/NioThread.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/hazelcast/src/main/java/com/hazelcast/internal/networking/nio/NioThread.java b/hazelcast/src/main/java/com/hazelcast/internal/networking/nio/NioThread.java index 76f3e43d9f7f..8fdf57399096 100644 --- a/hazelcast/src/main/java/com/hazelcast/internal/networking/nio/NioThread.java +++ b/hazelcast/src/main/java/com/hazelcast/internal/networking/nio/NioThread.java @@ -34,6 +34,7 @@ import java.util.Queue; import java.util.Random; import java.util.concurrent.ConcurrentLinkedQueue; +import java.util.logging.Level; import static com.hazelcast.internal.metrics.MetricDescriptorConstants.NETWORKING_METRIC_NIO_THREAD_BYTES_TRANSCEIVED; import static com.hazelcast.internal.metrics.MetricDescriptorConstants.NETWORKING_METRIC_NIO_THREAD_COMPLETED_TASK_COUNT; @@ -407,7 +408,7 @@ public void shutdown() { // this method is always invoked in this thread // after we have blocked for selector.select in #runSelectLoopWithSelectorFix private void rebuildSelector() { - selectorRebuildCount.inc(); + long currentSelectorRebuildCount = selectorRebuildCount.inc(); Selector newSelector = newSelector(logger); Selector oldSelector = this.selector; @@ -431,7 +432,8 @@ private void rebuildSelector() { // close the old selector and substitute with new one closeSelector(); this.selector = newSelector; - logger.warning("Recreated Selector because of possible java/network stack bug."); + Level logLevel = currentSelectorRebuildCount == 1 ? Level.WARNING : Level.FINE; + logger.log(logLevel, "Selector was rebuilt, consider updating Java and/or your network stack drivers."); } @Override