Skip to content

Commit

Permalink
Rephrase log message for selector rebuild (hazelcast#19761)
Browse files Browse the repository at this point in the history
When executing with selectwithfix, log
the first encounter of selector rebuild
as a WARNING, then continue logging at
FINE level.
  • Loading branch information
vbekiaris authored Oct 22, 2021
1 parent 91f223e commit 1405c2a
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand All @@ -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
Expand Down

0 comments on commit 1405c2a

Please sign in to comment.