RFR: 8294047: HttpResponseInputStream swallows interrupts [v4]

David M. Lloyd duke at openjdk.org
Mon Dec 5 12:56:11 UTC 2022


On Wed, 30 Nov 2022 14:09:06 GMT, Vyom Tewari <vtewari at openjdk.org> wrote:

>> Hmmm... Maybe a better solution would be to throw "ClosedByInterruptException" since we're also closing the input stream. And the specification of  "ClosedByInterruptException"  clearly state that the interrupt status of the thread will be preserved. Good question @vyommani .
>
> I am not 100% sure but for me the best option is call close() and  just restore the interrupt status let the caller decide how to handle the interrupt.

InterruptedIOException is not equivalent to InterrupedException in this way AFAIK. The thread interrupt status should be reset if _any_ exception other than InterruptedException is thrown AFAIK, otherwise thread interruption is likely to be lost.

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

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


More information about the net-dev mailing list