Improving perf of FileChannel.transferTo() on Windows

Alan Bateman Alan.Bateman at oracle.com
Sat Nov 8 12:44:07 UTC 2014


On 05/11/2014 17:50, Kirk Shoop (MS OPEN TECH) wrote:
>
> Here is the new webrev.
>
> https://openjdkcontrib.blob.core.windows.net/transferto/webrev-20141105.zip
>
> We also tried to apply what we learned from the previous submission, 
> so this one uses "jdk.net.enableFastFileTransfer" as the setting name, 
> allows -Djdk.net.enableFastFileTransfer to enable the setting and adds 
> a test that uses the setting.
>
>
I've created JDK-8064407 to track this.

One idea to integrate this is to add a canTransferTo(SelectableChannel) 
method to sun.nio.ch.FileDispatcher. That way the check for whether the 
channel is blocking and the other Windows-specific configuration can go 
into the Windows FileDispatcherImpl (keep it out of FileChannelImpl 
needing native methods for the other platforms).

One other point is that trasnferTo is specified not to change the 
channel's position. This means you will need to synchronize on the 
positionLock and restore the channel position after the TransmitFile. I 
don't know if you've figured out how to run jtreg to run tests but if 
you run the :jdk_nio group and specify 
-vmoption:-Djdk.net.enableFastFileTransfer=true to jtreg then you'll run 
all the relevant tests with this option.

-Alan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.openjdk.java.net/pipermail/nio-dev/attachments/20141108/18834221/attachment-0001.html>


More information about the nio-dev mailing list