SelectedSelectionKeySet should only be created if the set can be instrumented
Motivation: If we can not replace the internal used Set of the Selector there is no need to create an SelectedSelectionKeySet instance. Modification: Only create SelectedSelectionKeySet if we will replace the internal set. Result: Less object creation in some cases and cleaner code.
This commit is contained in:
parent
d133bf06a4
commit
b53cf045a7
@ -179,8 +179,6 @@ public final class NioEventLoop extends SingleThreadEventLoop {
|
|||||||
return new SelectorTuple(unwrappedSelector);
|
return new SelectorTuple(unwrappedSelector);
|
||||||
}
|
}
|
||||||
|
|
||||||
final SelectedSelectionKeySet selectedKeySet = new SelectedSelectionKeySet();
|
|
||||||
|
|
||||||
Object maybeSelectorImplClass = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
Object maybeSelectorImplClass = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||||
@Override
|
@Override
|
||||||
public Object run() {
|
public Object run() {
|
||||||
@ -206,6 +204,7 @@ public final class NioEventLoop extends SingleThreadEventLoop {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final Class<?> selectorImplClass = (Class<?>) maybeSelectorImplClass;
|
final Class<?> selectorImplClass = (Class<?>) maybeSelectorImplClass;
|
||||||
|
final SelectedSelectionKeySet selectedKeySet = new SelectedSelectionKeySet();
|
||||||
|
|
||||||
Object maybeException = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
Object maybeException = AccessController.doPrivileged(new PrivilegedAction<Object>() {
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user