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

Brian Burkhalter bpb at openjdk.org
Wed Jun 22 01:15:23 UTC 2022


On Fri, 17 Jun 2022 15:26:18 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:

>> 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(...)
>> }
>
> I wrote something like that before publishing this version and did not like it but now I think it might be better.

Refactored in commit 04d7502280df1dd0c2dccf34cc93450d86458e81.

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

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


More information about the nio-dev mailing list