RFR : 8221696: MappedByteBuffer.force method to specify range
adinn at redhat.com
Tue Apr 9 10:42:46 UTC 2019
Could I please get reviews for the following patch which overloads
MappedByteBuffer.force to accept a start offset and length.
This new API method was conceived as a preliminary change for JEP 352 to
allow selective writeback of NVRAM-backed buffers. However, it has been
implemented to provide a similar capability for file-mapped byte
buffers. The old brute-force API method, force(), continues to operate
as before for file-mapped byte buffers.
One detail that is worth highlighting is that for file-backed buffers
the start address passed to the native method force0 is rounded down to
a page boundary. This is needed for Unix implementations to ensure that
the underlying msync system call does not throw an exception.
I am not sure whether Windows imposes this same restriction. If not then
it might be better to perform the rounding in the native code. Advice
would be welcome.
I have only tested the new functionality on Linux. Assistance testing
this on other OSes would be appreciated.
[n.b. it should be enough to build with the patch and run
$ make test TEST=test/jdk/java/nio/channels/FileChannel/MapTest.java"
Updated MapTest.java: passes on Linux
Submit Test: in progress
Senior Principal Software Engineer
Red Hat UK Ltd
Registered in England and Wales under Company Registration No. 03798903
Directors: Michael Cunningham, Michael ("Mike") O'Neill, Eric Shander
More information about the core-libs-dev