Duplicate :
|
|
Duplicate :
|
|
Relates :
|
|
Relates :
|
With JDK 1.1.6, on Solaris, if you interrupt a thread which is blocked on network IO (specifically, read), the read gets terminated with InterruptedIOException. On Windows NT, no such exception is thrown and the thread is left blocked in the read call. Attached is a test program to demo the bug. On Solaris, the output is: pause... Waiting to accept connections: ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=1234] awake... Creating connection to server Created connection: Socket[addr=localhost/127.0.0.1,port=1234,localport=37294] pause... Got connection: Socket[addr=localhost/127.0.0.1,port=37294,localport=1234] Blocking on read awake... Interrupting other thread which should be stopped in read Interrupt called exiting PASS: Interrupted as expected java.io.InterruptedIOException: operation interrupted at java.net.SocketInputStream.read(SocketInputStream.java:92) at java.net.SocketInputStream.read(SocketInputStream.java:108) at test$1.run(test.java:19) gzilla% On Windows, the PASS line does not get generated: pause... Waiting to accept connections: ServerSocket[addr=0.0.0.0/0.0.0.0,port=0,localport=1234] awake... Creating connection to server Created connection: Socket[addr=localhost/127.0.0.1,port=1234,localport=1043] pause... Got connection: Socket[addr=localhost/127.0.0.1,port=1043,localport=1234] Blocking on read awake... Interrupting other thread which should be stopped in read Interrupt called exiting The source of this program is attached.
|