On Mon, 28 Nov 2022 14:21:01 GMT, Darragh Clarke <[email protected]> wrote:

>> Currently if a `HttpResonseInputStream` gets interrupted while reading it 
>> will just swallow the exception and continue,
>> 
>> This PR changes it to close the stream and throw an IOException, I added a 
>> test to cover this which just uses two threads to read the stream then 
>> interrupt it.
>
> Darragh Clarke has updated the pull request incrementally with one additional 
> commit since the last revision:
> 
>   fixed copyright year and formatting of a comment

Actually, there's one more thing that we probably should do. The API 
documentation of `HttpResponse.BodySubscribers::ofInputStream` has an 
`@apiNote` that emphasizes the need to read the stream to exhaustion, or call 
close, in order to release all resources.
We probably should also add an `@apiNote` to document that the default 
implementation returned by that method throw `InterruptedIOException` if the 
thread is interrupted while reading from the stream.

-------------

PR: https://git.openjdk.org/jdk/pull/11323

Reply via email to