RFR: 8271308: (fc) FileChannel.transferTo() transfers no more than Integer.MAX_VALUE bytes in one call [v2]
Brian Burkhalter
bpb at openjdk.java.net
Tue Aug 3 16:03:31 UTC 2021
On Tue, 3 Aug 2021 09:42:29 GMT, Alan Bateman <alanb at openjdk.org> wrote:
>> In the updated code, the direct transfer case no longer loops and just maps to one syscall. The previously introduced private `transferTo()` method is removed. `transferToArbitraryChannel()` is modified to have a `long`-valued count. `transferToTrustedChannel()` works out of the box as-is and is not changed.
>
> The update mostly looks okay, just wondering if could case maxDirectTransferSize to avoid the JNI call every time.
I think it could be a constant equal to either the Linux or Windows value, not `Integer.MAX_VALUE`, as that would force `TransmiteFile()` to fail for the `MAX_VALUE` case. Or the JNI call could be made just once when setting up.
-------------
PR: https://git.openjdk.java.net/jdk/pull/4940
More information about the nio-dev
mailing list