RFR: 8361495: (fc) Async close of streams connected to uninterruptible FileChannel doesn't throw AsynchronousCloseException in all cases [v4]

Alan Bateman alanb at openjdk.org
Sun Aug 24 07:32:02 UTC 2025


On Mon, 11 Aug 2025 19:06:29 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Throw `AsynchronousCloseException` from `FileChannelImpl` methods if the channel is uninterruptible and was closed before the method (operation) could complete.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   8361495: Remove commented out code and low value print statement

test/jdk/java/nio/channels/FileChannel/ChannelInputStreamTest.java line 43:

> 41: import org.junit.jupiter.api.Test;
> 42: 
> 43: public class ChannelInputStreamTest {

This is a test for async close of input/output streams obtained from Channels.newInputStream and Channels.newOutputStream so we need to decide whether to put the test and how to name it. Maybe channels/Channels/AsyncCloseStreams.java so it is located with the other tests for Channels?

test/jdk/java/nio/channels/FileChannel/ChannelInputStreamTest.java line 75:

> 73:                 in = Files.newInputStream(path);
> 74:             } catch (IOException ignored) {
> 75:                 continue;

Why is the exception ignored?

test/jdk/java/nio/channels/FileChannel/ChannelInputStreamTest.java line 100:

> 98:             closeThread.join();
> 99:         } catch (InterruptedException ignored) {
> 100:         }

I assume we shouldn't catch InterruptedExcepiton here, this could only happen if at test timeout and jtreg is attempted to cleanup.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/26435#discussion_r2296547068
PR Review Comment: https://git.openjdk.org/jdk/pull/26435#discussion_r2296547174
PR Review Comment: https://git.openjdk.org/jdk/pull/26435#discussion_r2296547450


More information about the nio-dev mailing list