Ensure the selector implementation can be instrumented before attempting instrumentation

- Fixes #1908
This commit is contained in:
Trustin Lee 2013-10-11 12:07:46 +09:00
parent 522dbf8543
commit 16bf687aec

View File

@ -137,7 +137,12 @@ public final class NioEventLoop extends SingleThreadEventLoop {
Class<?> selectorImplClass =
Class.forName("sun.nio.ch.SelectorImpl", false, ClassLoader.getSystemClassLoader());
selectorImplClass.isAssignableFrom(selector.getClass());
// Ensure the current selector implementation is what we can instrument.
if (!selectorImplClass.isAssignableFrom(selector.getClass())) {
return selector;
}
Field selectedKeysField = selectorImplClass.getDeclaredField("selectedKeys");
Field publicSelectedKeysField = selectorImplClass.getDeclaredField("publicSelectedKeys");