Two small fixes
Rémi Forax
forax at univ-mlv.fr
Sun Aug 22 07:22:54 PDT 2010
Le 21/08/2010 17:17, Alan Bateman a écrit :
> I'd like to get fixes for two small fixes into b108.
>
> The first is 6431344 where FileChannel's transferTo falls back to mmap
> when sendfile/equivalent can't be used and the target is a "trusted
> channel". The implementation attempts to mmap the entire region to be
> transferred which is problematic for large transfers, esp. 32-bit
> where the address space may not be available. Same issue with
> transferFrom where mmap is used when the source is also a FileChannel.
> The proposed change just maps the file in chunks, up to 8MB at a time.
> I don't propose to include a regression test as the code is well
> exercised by existing tests, and also tests that transfer several GBs
> take too long for the regression test suite. The webrev is here:
> http://cr.openjdk.java.net/~alanb/6431344/webrev
a minor nit:
line 468 (end of transferToTrustedChannel) should be :
return count - remaining;
instead of
return count-remaining;
I wonder if the 8 megs is enough. I've played some time ago with Windows XP
mmap using Java API and found that it was more efficient to use read()
if the file length was less than few hundred megabytes.
It was ok for linux, and i have not tested with more recent version of
Windows.
>
> The other one is 6978511, an oversight in the implementation to
> Path.toRealPath. The method should fail if the file does not exist.
> The fix is to trivially check that it does actually exist. The webrev
> is here:
> http://cr.openjdk.java.net/~alanb/6978511/webrev/
fine, even if the patch is named ScatterGather :)
>
> Thanks,
> Alan.
Rémi
More information about the nio-dev
mailing list