Skip to content

Commit bf2ab60

Browse files
jasontedornormanmaurer
authored andcommitted
Do not log on explicit no unsafe again
Motivation: Users should not see a scary log message when Netty is initialized if Netty configuration explicitly disables unsafe. The log message that produces this warning was previously guarded but the guard was lost. Modifications: This commit brings back the guard against the scary log message if unsafe is explicitly disabled. Result: No log message is produced when unsafe is unavailable because Netty was told to not look for it.
1 parent 5c1480b commit bf2ab60

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

common/src/main/java/io/netty/util/internal/PlatformDependent.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,11 @@ public Random current() {
123123
logger.debug("-Dio.netty.noPreferDirect: {}", !DIRECT_BUFFER_PREFERRED);
124124
}
125125

126-
if (!hasUnsafe() && !isAndroid()) {
126+
/*
127+
* We do not want to log this message if unsafe is explicitly disabled. Do not remove the explicit no unsafe
128+
* guard.
129+
*/
130+
if (!hasUnsafe() && !isAndroid() && !PlatformDependent0.isExplicitNoUnsafe()) {
127131
logger.info(
128132
"Your platform does not provide complete low-level API for accessing direct buffers reliably. " +
129133
"Unless explicitly requested, heap buffer will always be preferred to avoid potential system " +

0 commit comments

Comments
 (0)