RFR: 8294047: HttpResponseInputStream swallows interrupts [v4]
Vyom Tewari
vtewari at openjdk.org
Wed Nov 30 14:11:28 UTC 2022
On Wed, 30 Nov 2022 11:00:58 GMT, Daniel Fuchs <dfuchs at openjdk.org> wrote:
>> src/java.net.http/share/classes/jdk/internal/net/http/ResponseSubscribers.java line 491:
>>
>>> 489: // Throw InterruptedIOException where the initCause is
>>> 490: // set to the caught InterruptedException
>>> 491: throw Utils.toInterruptedIOException(ex);
>>
>> Don't you think you need to restores the interrupt status of the thread by invoking the Thread.currentThread().interrupt() method and allowing the caller to detect the interrupt if it needs to ?
>
> 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.
-------------
PR: https://git.openjdk.org/jdk/pull/11323
More information about the net-dev
mailing list