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() {