RFR [8058099] (ch) Cleanup in FileChannel/FileDispatcher native implementation [win]

Alan Bateman Alan.Bateman at oracle.com
Tue Sep 23 13:11:01 UTC 2014


On 23/09/2014 13:59, Doerr, Martin wrote:
> :
>
> I didn't dig through all the code to find out where we got the file handle from, but I assume it was opened for asynchronous I/O since the test is called AsynchronousFileChannel and the method holder class is WindowsAsynchronousFileChannelImpl.
> I guess asynchronous is used for concurrent read and write operations and the asynchronous file locking is just a side effect which was not intended?
>
>
Thanks, this helps clarify things.

AsynchronousFileChannel needs to open files with FILE_FLAG_OVERLAPPED 
enabled because it supports asynchronous operations. FileChannel does 
not use this flag because it is synchronous. The method that throws the 
exception for you is tryLock which is synchronous and is the same code 
for both channel types. So it was correct for it to handle ERROR_IO_PENDING.

Ivan - I think you are good to go.



More information about the nio-dev mailing list