RFR: 8361495: (fc) Async close of streams connected to uninterruptible FileChannel doesn't throw AsynchronousCloseException in all cases [v5]
Brian Burkhalter
bpb at openjdk.org
Tue Aug 26 16:25:53 UTC 2025
On Tue, 26 Aug 2025 06:43:22 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> Brian Burkhalter has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains six additional commits since the last revision:
>>
>> - 8361495: Rename test and improve as suggested
>> - Merge
>> - 8361495: Remove commented out code and low value print statement
>> - 8361495: Add read and write tests and convert to JUnit 5
>> - 8361495: Clean up initial test
>> - 8361495: (fc) Async close of streams connected to uninterruptible FileChannel doesn't throw AsynchronousCloseException in all cases
>
> test/jdk/java/nio/channels/Channels/AsyncCloseStreams.java line 52:
>
>> 50: try {
>> 51: Closeable c;
>> 52: if ((c = q.take()) != null) {
>
> The loop could be simplified to use `while ((c = q.take()) != STOP)`.
Good.
> test/jdk/java/nio/channels/Channels/AsyncCloseStreams.java line 85:
>
>> 83: available = in.available();
>> 84: } catch (AsynchronousCloseException ace) {
>> 85: System.out.println("AsynchronousCloseException caught");
>
> JUnit prints to stderr so this trace message won't be inlined with the test.
I know JUnit prints to stderr but I was going to remove the trace. I think it better now to redirect it to stderr.
> test/jdk/java/nio/channels/Channels/AsyncCloseStreams.java line 99:
>
>> 97: }
>> 98: } while (true);
>> 99: } finally {
>
> If the finally blocks were to offer the STOP element then it would remove it from the 3 exit paths and make it more robust.
Good idea.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/26435#discussion_r2301517528
PR Review Comment: https://git.openjdk.org/jdk/pull/26435#discussion_r2301517797
PR Review Comment: https://git.openjdk.org/jdk/pull/26435#discussion_r2301517685
More information about the nio-dev
mailing list