Name: skT45625 Date: 06/12/2000
java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)
This is similar to bug 4075058 about non-blocking IO, but has a slightly
different slant and so did not want to just put it in as a comment.
HttpURLConnection.getInputStream() blocks until data is recieved on the
stream. There are ways to get around the blocking io issue, but these involve
doing something to the InputStream to force it out of its blocked state.
HttpURLConnection blocks when simply returning the stream, thus negating the
ability to add non-blocking functionality.
The implementation of HttpURLConnection is a sun.net class and so the details
are hidden. I don't know if it is simply waiting for header information before
it returns or what, but it would be helpful if the getInputStream() method
could return immediately.
Alternatively, calling close() on a blocked InputStream seems to force it out
of its blocked state. HttpURLConnection.disconnect() does not behave
similiarly. If disconnect() could force getInputStream() to throw an
exception, this would provide a workaround to the issue.
(Review ID: 106045)
======================================================================
- duplicates
-
JDK-4333920 getInputStream on URLConnection doesn't return until complete response arrives
-
- Resolved
-