6346658: (se) Selector briefly spins when asynchronously closing a registered channel [win]

Alan Bateman Alan.Bateman at oracle.com
Mon Feb 20 06:52:33 PST 2012


Asynchronous close has always been problematic on Windows, mostly 
because that platform lacks a means to close a file or connection 
without releasing the handle. I'd like to change the implementation so 
that closing a FileChannels or SocketChannel configured non-blocking 
works cooperatively. In the case of FileChannel this means the close is 
postponed until the last thread is finished doing I/O on the channel, 
with SocketChannels registered with Selectors it means the close is done 
when deregistering from the Selector. There isn't any change to 
SocketChannels configured blocking. The webrev with the proposed changes 
is here:

http://cr.openjdk.java.net/~alanb/6346658/webrev/

For now I don't have any automated tests to go along with this. I have a 
test for FileChannel but it runs for several hours and so is not 
suitable for the regression suite. All existing tests pass on all 
platforms with these changes.

-Alan.


More information about the nio-dev mailing list