more work on nio event loop

This commit is contained in:
Jörg Prante 2023-09-22 16:44:13 +02:00
parent 98d0a34c88
commit 1873883284
2 changed files with 1 additions and 6 deletions

View file

@ -136,11 +136,9 @@ public final class NioEventLoop extends SingleThreadEventLoop {
} catch (IOException e) { } catch (IOException e) {
throw new EventLoopException("failed to open a new selector", e); throw new EventLoopException("failed to open a new selector", e);
} }
if (DISABLE_KEY_SET_OPTIMIZATION) { if (DISABLE_KEY_SET_OPTIMIZATION) {
return new SelectorTuple(unwrappedSelector); return new SelectorTuple(unwrappedSelector);
} }
Class<?> maybeSelectorImplClass = null; Class<?> maybeSelectorImplClass = null;
try { try {
maybeSelectorImplClass = Class.forName("sun.nio.ch.SelectorImpl", false, maybeSelectorImplClass = Class.forName("sun.nio.ch.SelectorImpl", false,
@ -148,7 +146,6 @@ public final class NioEventLoop extends SingleThreadEventLoop {
} catch (ClassNotFoundException e) { } catch (ClassNotFoundException e) {
// //
} }
// ensure the current selector implementation is what we can instrument. // ensure the current selector implementation is what we can instrument.
if (maybeSelectorImplClass == null || !maybeSelectorImplClass.isAssignableFrom(unwrappedSelector.getClass())) { if (maybeSelectorImplClass == null || !maybeSelectorImplClass.isAssignableFrom(unwrappedSelector.getClass())) {
return new SelectorTuple(unwrappedSelector); return new SelectorTuple(unwrappedSelector);
@ -751,7 +748,7 @@ public final class NioEventLoop extends SingleThreadEventLoop {
private static boolean isExplicitTryReflectionSetAccessible() { private static boolean isExplicitTryReflectionSetAccessible() {
// we disable reflective access // we disable reflective access
boolean defaultValue = javaVersion() < 9 || System.getProperties().containsKey("org.graalvm.nativeimage.imagecode"); boolean defaultValue = javaVersion() < 9 || System.getProperties().containsKey("org.graalvm.nativeimage.imagecode");
return Boolean.parseBoolean(System.getProperties().getProperty("io.netty.tryReflectionSetAccessible", return Boolean.parseBoolean(System.getProperties().getProperty("org.xbib.tryReflectionSetAccessible",
Boolean.toString(defaultValue))); Boolean.toString(defaultValue)));
} }

View file

@ -20,12 +20,10 @@ final class SelectedSelectionKeySet extends AbstractSet<SelectionKey> {
if (o == null) { if (o == null) {
return false; return false;
} }
keys[size++] = o; keys[size++] = o;
if (size == keys.length) { if (size == keys.length) {
increaseCapacity(); increaseCapacity();
} }
return true; return true;
} }