[kaffe] gnu.java.nio.VMSelector implementation
Rei Odaira
ray at is.s.u-tokyo.ac.jp
Mon Mar 28 10:16:40 PST 2005
Hi,
I'm trying to run Tomcat 5 with clustering support on Kaffe/jthread.
The current implementation of gnu.java.nio.VMSelector#select()
seems to directly invoke a system call "select()", instead of KSELECT().
Since the system call is not aware of jthread, Kaffe can stop
indefinitely when java.nio.channels.Selector#select() is called
with timeout == 0 (blocking mode).
Below is a simple testcase.
I think the previous implementation, which uses KSELECT(), would be better,
although it has several serious bugs.
Any thoughts?
Rei
##################################################
import java.net.*;
import java.nio.channels.*;
class TestSelector {
TestSelector() {
(new Runner()).start();
}
void doSelect() {
try {
ServerSocketChannel serverChannel = ServerSocketChannel.open();
ServerSocket serverSocket = serverChannel.socket();
Selector selector = Selector.open();
serverSocket.bind (new InetSocketAddress (InetAddress.getLocalHost(), 10001));
serverChannel.register (selector, SelectionKey.OP_ACCEPT);
selector.select(0);
} catch (Exception ex) {
}
}
public static void main(String[] args) {
(new TestSelector()).doSelect();
}
class Runner extends Thread {
public void run() {
int i = 0;
while (true) {
if (i % 100000 == 0) {
System.out.println(i);
}
i++;
}
}
}
}
##################################################
> java TestSelector
0
100000
200000
300000
400000
500000
600000
700000
800000
900000
... (continues indefinitely)
> kaffe TestSelector
0
100000
(stops here)
##################################################
More information about the kaffe
mailing list