Warn in case of incomplete low-level API

This commit is contained in:
Trustin Lee 2013-03-05 18:06:01 +09:00
parent 4cb023f190
commit c5f606e632

View File

@ -16,6 +16,8 @@
package io.netty.util.internal;
import io.netty.util.internal.chmv8.ConcurrentHashMapV8;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import java.lang.reflect.Field;
import java.net.InetSocketAddress;
@ -56,6 +58,16 @@ public final class PlatformDependent {
private static final boolean HAS_JAVASSIST = hasJavassist0();
static {
InternalLogger logger = InternalLoggerFactory.getInstance(PlatformDependent.class);
if (!hasUnsafe()) {
logger.warn(
"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 risk of getting OutOfMemoryError.");
}
}
/**
* Returns {@code true} if and only if the current platform is Android
*/