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 9df2540da7
commit 5e96112811

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");
}
}