Epoll.isAvailable() must return false if sun.misc.Unsafe is not present.

Motivation:

Currently our epoll native transport requires sun.misc.Unsafe and so we need to take this into account for Epoll.isAvailable().

Modifications:

Take into account if sun.misc.Unsafe is present.

Result:

Only return true for Epoll.isAvailable() if sun.misc.Unsafe is present.
This commit is contained in:
Norman Maurer 2016-02-05 12:59:31 +01:00
parent a88c89a426
commit f10d66b45e

View File

@ -16,6 +16,7 @@
package io.netty.channel.epoll;
import io.netty.channel.unix.FileDescriptor;
import io.netty.util.internal.PlatformDependent;
/**
* Tells if <a href="http://netty.io/wiki/native-transports.html">{@code netty-transport-native-epoll}</a> is supported.
@ -53,7 +54,8 @@ public final class Epoll {
if (cause != null) {
UNAVAILABILITY_CAUSE = cause;
} else {
UNAVAILABILITY_CAUSE = null;
UNAVAILABILITY_CAUSE = PlatformDependent.hasUnsafe() ? null :
new IllegalStateException("sun.misc.Unsafe not available");
}
}