Skip to content

Commit

Permalink
Merge pull request spring-projects#276 from garyrussell/INT-2333
Browse files Browse the repository at this point in the history
  INT-2333 Work Around for MAC OSX JVM Bug
  • Loading branch information
markfisher committed Dec 22, 2011
2 parents bc09b06 + 49c5235 commit 1a7dae5
Showing 1 changed file with 9 additions and 1 deletion.
Expand Up @@ -20,6 +20,7 @@
import java.net.InetSocketAddress;
import java.net.SocketException;
import java.nio.ByteBuffer;
import java.nio.channels.CancelledKeyException;
import java.nio.channels.ClosedChannelException;
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
Expand Down Expand Up @@ -123,7 +124,14 @@ public void run() {
while (this.isActive()) {
SocketChannel newChannel;
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()");
}
}
while ((newChannel = newChannels.poll()) != null) {
try {
newChannel.register(this.selector, SelectionKey.OP_READ, connections.get(newChannel));
Expand Down

0 comments on commit 1a7dae5

Please sign in to comment.