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 d946659520
commit c9b7f1f1b5

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