On Wed, 30 Nov 2022 14:09:06 GMT, Vyom Tewari <[email protected]> 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
