RFR: 6980847: (fs) Files.copy needs to be tuned [v5]

Alan Bateman alanb at openjdk.org
Fri Jun 17 12:06:57 UTC 2022


On Thu, 16 Jun 2022 23:36:34 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> Modify `UnixCopyFile.copyFile()` to set the transfer size to the least common multiple of the source and destination file block sizes if the block sizes are not equal. Modify `WindowsFileCopy.copy()` to set `COPY_FILE_NO_BUFFERING` in the flags passed to `CopyFileEx()` if the size of the transfer is greater than a threshold.
>
> Brian Burkhalter has updated the pull request incrementally with one additional commit since the last revision:
> 
>   6980847: Use temporary direct buffer for user-space copy

src/java.base/unix/classes/sun/nio/fs/UnixCopyFile.java line 315:

> 313:                         if (buf != null) {
> 314:                             Util.releaseTemporaryDirectBuffer(buf);
> 315:                         }

I don't think this is maintainable as is, instead I think the two cases need to moved to supporting methods so you can have something like:


if (transferRequiresBuffer) {
    transferWithTemporyBuffer(...);
} else {
    transferDirect(...)
}

-------------

PR: https://git.openjdk.org/jdk/pull/9161


More information about the nio-dev mailing list