RFR: 8357847: (ch) AsynchronousFileChannel implementations should support FFM Buffers [v4]
Alan Bateman
alanb at openjdk.org
Mon Jun 9 12:34:54 UTC 2025
On Thu, 5 Jun 2025 17:48:48 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
>> Acquire the scope of a direct buffer before it is used and release it after the task has finished with it, whether the task execution is immediate or pended.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
>
> 8357912: Add reading to test of unsupported views
src/java.base/share/classes/sun/nio/ch/SimpleAsynchronousFileChannelImpl.java line 393:
> 391: if (src.isDirect()) {
> 392: IOUtil.acquireScope(src, true);
> 393: ((DirectBuffer)src).address();
Is the using of address() here for testing purposes?
test/jdk/java/nio/channels/AsynchronousFileChannel/Basic.java line 632:
> 630: rand.nextBytes(buf);
> 631: Arena arena = isConfined ? Arena.ofConfined() : Arena.ofShared();
> 632: return arena.allocate(buf.length).asByteBuffer().put(buf).flip();
For the asynchronous channels then we should only prohibit thread-confined, using a buffer that is a view of a memory segment allocated from a shared arena is okay. I've included (disabled-for-now) test in draft changes for JDK-8358958 to test attempting to close a shared arena while a write op is outstanding, I think we can use that to test the changes here.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/25531#discussion_r2135636952
PR Review Comment: https://git.openjdk.org/jdk/pull/25531#discussion_r2135634762
More information about the nio-dev
mailing list