P
Peter Carter
hi all.
I'm having a problem with the java.nio package.
I've written a package that encapsulates java.nio and makes it usable.
However, there's a small bug. The classes work fine, however, when I
create a new ServerSocketChannel and bind on a port, leave it running
(at this point it works fine, it accepts connections & all).
Now, if I open the Network Connections window, and down one of my
network interfaces, the cpu usage rises up to 100%.
This is because the select() method no longer blocks and returns 0 all
the time... how strange.
Now, I have tried this with JDK 1.4.2_03 and 1.5: same result. I've
tried this on a Win2k server box, same result ... and on my WinXP
development machine.
The reason I'm downing my network interfaces is because this started
to happen on a computer that has a dial-up connection. Now whenever
the dial-up interface was killed, javaw.exe's process would rise up to
100% cpu.
I also looked around the forum and found an interesting post on the
Sun Forums: Taming the NIO circus, or something. They had java.nio
code, I tried it out. The code seemed to have the same problem as
mine... So I'm guessing that it might be a bug in the JVM...
Anyway, their solution was simple, if select returns the value "0" ten
times, the program exits.
It might be an acceptable solution for a test program, but its no
solution here.
Is there any way to fix this?
Thank you for your time.
I'm having a problem with the java.nio package.
I've written a package that encapsulates java.nio and makes it usable.
However, there's a small bug. The classes work fine, however, when I
create a new ServerSocketChannel and bind on a port, leave it running
(at this point it works fine, it accepts connections & all).
Now, if I open the Network Connections window, and down one of my
network interfaces, the cpu usage rises up to 100%.
This is because the select() method no longer blocks and returns 0 all
the time... how strange.
Now, I have tried this with JDK 1.4.2_03 and 1.5: same result. I've
tried this on a Win2k server box, same result ... and on my WinXP
development machine.
The reason I'm downing my network interfaces is because this started
to happen on a computer that has a dial-up connection. Now whenever
the dial-up interface was killed, javaw.exe's process would rise up to
100% cpu.
I also looked around the forum and found an interesting post on the
Sun Forums: Taming the NIO circus, or something. They had java.nio
code, I tried it out. The code seemed to have the same problem as
mine... So I'm guessing that it might be a bug in the JVM...
Anyway, their solution was simple, if select returns the value "0" ten
times, the program exits.
It might be an acceptable solution for a test program, but its no
solution here.
Is there any way to fix this?
Thank you for your time.