INT-2333 Mac OSX TCP Workaround on Server Side

Mac OSX problem was encountered only on the client; similar
code exists on the server side, so the workaround should
be implemented there too; just in case.
This commit is contained in:
Gary Russell
2011-12-22 16:26:50 -05:00
parent 1a7dae5f27
commit 3c49cb3480

View File

@@ -21,6 +21,7 @@ import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.net.SocketException;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
@@ -114,7 +115,14 @@ public class TcpNioServerConnectionFactory extends AbstractServerConnectionFacto
throws IOException, ClosedChannelException, SocketException {
while (this.isActive()) {
int soTimeout = this.getSoTimeout();
int selectionCount = selector.select(soTimeout < 0 ? 0 : soTimeout);
int selectionCount = 0;
try {
selectionCount = selector.select(soTimeout < 0 ? 0 : soTimeout);
} catch (CancelledKeyException cke) {
if (logger.isDebugEnabled()) {
logger.debug("CancelledKeyException during Selector.select()");
}
}
this.processNioSelections(selectionCount, selector, server, this.connections);
}
}