Merge pull request #277 from garyrussell/INT-2333a

INT-2333 Mac OSX TCP Workaround on Server Side
This commit is contained in:
Mark Fisher
2011-12-22 16:42:09 -05:00

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);
}
}