Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4344986

HttpURLConnection blocks when returning a stream, not just reading.

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • core-libs
    • x86
    • windows_2000



      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)
      ======================================================================

            alanb Alan Bateman
            skondamasunw Suresh Kondamareddy (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: