Use Selecor.select() to accept new Sockets to not need to schedule a timeout if not needed anyway. See #567

This commit is contained in:
Norman Maurer 2012-08-26 08:46:48 +02:00
parent 1a6e7b4be1
commit 5d07dea3b7

View File

@ -226,11 +226,12 @@ class NioServerSocketPipelineSink extends AbstractNioChannelSink {
try {
for (;;) {
try {
if (selector.select(1000) > 0) {
// There was something selected if we reach this point, so clear
// the selected keys
selector.selectedKeys().clear();
}
// Just do a blocking select without any timeout
// as this thread does not execute anything else.
selector.select();
// There was something selected if we reach this point, so clear
// the selected keys
selector.selectedKeys().clear();
// accept connections in a for loop until no new connection is ready
for (;;) {