From 4a5b61fc13022d0c2cddc93258f303b1a4948cfe Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Thu, 30 Aug 2018 06:57:12 +0200 Subject: [PATCH] Fix log message about using non-direct buffers by default (#8235) Motivation: f77891cc1786806630f6c4408d5d37abb1891e7b changed slightly how we detect if we should prefer direct buffers or not but did miss to also take this into account when logging. Modifications: Fix branch for log message to reflect changes in f77891cc1786806630f6c4408d5d37abb1891e7b. Result: Correct logging. --- .../util/internal/PlatformDependent.java | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/common/src/main/java/io/netty/util/internal/PlatformDependent.java b/common/src/main/java/io/netty/util/internal/PlatformDependent.java index 6a534bcff0..8d44920cc2 100644 --- a/common/src/main/java/io/netty/util/internal/PlatformDependent.java +++ b/common/src/main/java/io/netty/util/internal/PlatformDependent.java @@ -128,17 +128,6 @@ public final class PlatformDependent { }; } - /* - * We do not want to log this message if unsafe is explicitly disabled. Do not remove the explicit no unsafe - * guard. - */ - if (!hasUnsafe() && !isAndroid() && !PlatformDependent0.isExplicitNoUnsafe()) { - logger.info( - "Your platform does not provide complete low-level API for accessing direct buffers reliably. " + - "Unless explicitly requested, heap buffer will always be preferred to avoid potential system " + - "instability."); - } - // Here is how the system property is used: // // * < 0 - Don't use cleaner, and inherit max direct memory from java. In this case the @@ -193,6 +182,17 @@ public final class PlatformDependent { if (logger.isDebugEnabled()) { logger.debug("-Dio.netty.noPreferDirect: {}", !DIRECT_BUFFER_PREFERRED); } + + /* + * We do not want to log this message if unsafe is explicitly disabled. Do not remove the explicit no unsafe + * guard. + */ + if (CLEANER == NOOP && !PlatformDependent0.isExplicitNoUnsafe()) { + logger.info( + "Your platform does not provide complete low-level API for accessing direct buffers reliably. " + + "Unless explicitly requested, heap buffer will always be preferred to avoid potential system " + + "instability."); + } } public static boolean hasDirectBufferNoCleanerConstructor() {