RFR : 8221696: MappedByteBuffer.force method to specify range

Alan Bateman Alan.Bateman at oracle.com
Mon Apr 22 15:52:14 UTC 2019


On 18/04/2019 10:17, Andrew Dinn wrote:
> Hi Alan,
>
> The CSR for this issue has been finalized and is awaiting approval.
> Would it now be possible to proceed with reviews of the implementation?
>
> JIRA:   https://bugs.openjdk.java.net/browse/JDK-8221696
> webrev: http://cr.openjdk.java.net/~adinn/8221696/webrev.01
>
The calculation to compute the page aligned address and then the 
distance from there to the end of the region is tricky to get right. I 
think you have it right, I'm just wondering if we could leverage the 
existing mappingOffset/mappingAddress methods so that we have only one 
place to audit. For example, suppose mappingOffset is changed to take an 
index. I think this would reduce the new force method down to:

long offset = mappingOffset(index);
force0(fd, mappingAddress(offset), offset + length);

We'd need to add an overload so that the existing usages of 
mappingOffset would continue to work, or we change then to use 
mappingOffset(0).  Just something to think about because this code is 
tricky.

I don't expect any issues on Windows but I will test it to make sure.

-Alan



More information about the nio-dev mailing list