JDK-4066000 : Interruption fails with SocketInputStreams
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.net
  • Affected Version: 1.1.3,1.1.4
  • Priority: P3
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-07-21
  • Updated: 1998-04-14
  • Resolved: 1998-04-14
Related Reports
Duplicate :  
Description

Name: rlT66838			Date: 07/21/97


The problem is really quite simple: When you do a read() on an SocketInputStream the thread executing the read() blocks if there is no input available. 
Normally you should be able to interrupt() the thread, getting an InterruptedIOException and terminating the read(). But in the case of SocketInputStream this does 
not work. When exchanging the SocketInputStream with a PipedInputStream in my test program, everything works as expected.
Im my opinion, the implementation of SocketInputStream is broken.


======================================================================

Comments
WORK AROUND Name: rlT66838 Date: 07/21/97 Continually polling the stream with available(), whenever there is something read it in, if not check the current thread for isInterrupted() and throw an I nterruptedIOException explicitly to shield client code. ======================================================================
11-06-2004