Skip to content

Commit

Permalink
Epoll.isAvailable() must return false if sun.misc.Unsafe is not present.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
normanmaurer committed Feb 6, 2016
1 parent 8a5a934 commit 36f5069
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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");
}
}

Expand Down

0 comments on commit 36f5069

Please sign in to comment.