RFR: 8316660: Use a MemorSegment for file mapping in FileChannelLinesSpliterator
Alan Bateman
alanb at openjdk.org
Thu Sep 21 11:06:40 UTC 2023
On Thu, 21 Sep 2023 10:50:49 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> This PR proposes using a `MemorySegment` instead of a `ByteBuffer` in `FileChannelLinesSpliterator`.
>>
>> The old solution deterministically unmapped the ByteBuffer if closed. If not closed, the ByteBuffer would be GC:ed.
>>
>> This proposal mimics the old behavior but may hold the mapped memory region slightly longer.
>>
>> Tested and passed tier1, tier2, tier3
>
> test/jdk/java/nio/file/FileChannelLinesSpliterator/Parallel.java line 45:
>
>> 43: import static org.junit.jupiter.api.Assertions.*;
>> 44:
>> 45: public class Parallel {
>
> This test should needs to move to test/jdk/java/nio/file/Files and be named something like LinesParallel. The description can also say that it's a test for Files.lines.
I also changed the JBS issue to make it clear that this is about the Files.lines implementation, do you mind adjusting the PR to align with that as "FileChannelLinesSplitator" is an internal class.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/15814#discussion_r1332880813
More information about the nio-dev
mailing list