Improving perf of FileChannel.transferTo() on Windows

Kirk Shoop (MS OPEN TECH) Kirk.Shoop at
Tue Nov 11 18:04:44 UTC 2014

From: Alan Bateman [mailto:Alan.Bateman at]

I've created JDK-8064407 to track this.
Thanks! Feel free to ask/teach us to open these in the future.

One idea to integrate this is to add a canTransferTo(SelectableChannel) method to 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 to jtreg then you'll run all the relevant tests with this option.

Valery applied both of your suggestions and was able to run the jtreg tests with this new webrev:


Microsoft Open Technologies, Inc.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the nio-dev mailing list