RFR : 8221696: MappedByteBuffer.force method to specify range

Daniel Fuchs daniel.fuchs at oracle.com
Tue Apr 9 11:28:06 UTC 2019


Hi Andrew,

On 09/04/2019 11:42, Andrew Dinn wrote:
> 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.

Maybe this should be highlighted in the API documentation too,
possibly as a non-normative implementation detail - stating
that an implementation is free to do this (e.g. in an
@implNote).

My reading of your current proposed specification is that
`from` is
  234      *        The offset to the first byte in the buffer region that
  235      *        is to be written back to storage

and well - if I'm not mistaken then it appears the implementation
can write some bytes before `from`, and that would be observable
if you compared the file before and after calling force, isn't it?

best regards,

-- daniel

> JIRA:   https://bugs.openjdk.java.net/browse/JDK-8221696
> webrev: http://cr.openjdk.java.net/~adinn/8221696/webrev.00



More information about the nio-dev mailing list