Small optimization to save the allocation of an iterator,
in case the selector has been woken up without selected keys. Signed-off-by: Simone Bordet <simone.bordet@gmail.com>
This commit is contained in:
parent
a107bdd2bb
commit
adeaf77c02
|
@ -397,7 +397,7 @@ public class ManagedSelector extends ContainerLifeCycle implements Dumpable
|
||||||
}
|
}
|
||||||
|
|
||||||
_keys = selector.selectedKeys();
|
_keys = selector.selectedKeys();
|
||||||
_cursor = _keys.iterator();
|
_cursor = _keys.isEmpty() ? Collections.emptyIterator() : _keys.iterator();
|
||||||
if (LOG.isDebugEnabled())
|
if (LOG.isDebugEnabled())
|
||||||
LOG.debug("Selector {} processing {} keys, {} updates", selector, _keys.size(), updates);
|
LOG.debug("Selector {} processing {} keys, {} updates", selector, _keys.size(), updates);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue