Problem with Selector.select() NIO
Are there still issues in
java.nio.channels.Selector.select() when running on solaris.
It perfectly works fine in windows XP.
We are able to register a selector with a channel and successfully retrieve SelectionKey. But when doing a select after registration the selection key is lost (count = 0) on solaris
selector.select(TIMEOUT_CHECK_INTERVAL);
returns count = 0;
We have tested with jdk1.5.06 as well as 1.5.11. The Solaris version is 5.9
There are no exceptions messages.
There are some thread posts realted to this issue, could barely see any answers.
http://forum.java.sun.com/thread.jspa?forumID=4&threadID=293672
http://forum.java.sun.com/thread.jspa?forumID=256&threadID=420607
Any help on this issue will be greatly appreciated.
# 2
This is a client program.
1. Registers selector with a channel. Retrieved a valid Selection Key.
-
SelectionKey key;
try {
key = socketChannel.register(this.selector, 0);
request.setKey(key);
} catch (IOException ex) {
throw new IOReactorException("Failure registering channel " +
"with the selector", ex);
}
SessionRequestHandle requestHandle = new SessionRequestHandle(request);
key.attach(requestHandle);
key.interestOps(SelectionKey.OP_CONNECT);
--
2. select keys
for (;;) {
int readyCount;
try {
readyCount = this.selector.select(TIMEOUT_CHECK_INTERVAL);
} catch (InterruptedIOException ex) {
throw ex;
} catch (IOException ex) {
throw new IOReactorException("Unexpected selector failure", ex);
}
if (this.closed) {
break;
}
processSessionRequests();
if (readyCount > 0) {
processEvents(this.selector.selectedKeys());
}
Step 2 works in windows (returns count = 1) but in solaris returns 0 and no selected keys.