review request: 7184932: Remove the temporary Selector usage in the NIO socket adapters

Alan Bateman Alan.Bateman at
Thu Jul 19 03:27:25 PDT 2012

On 18/07/2012 14:36, Rob McKenna wrote:
> Hi folks,
> Looking for a review for the above. This fix replaces temporary 
> selectors with a poll method in SocketAdaptor.
> <>
>     -Rob
Thanks for taking this one (as background to others, the issue here is 
applications with hundreds of threads using the socket adapters means 
that there are a hundreds of temporary Selectors cached, there are also 
issues with applications that create short-lived threads doing timed 
operations using the socket adapters).

One thing that doesn't seem right is the return from the Windows 
implementation of Java_sun_nio_ch_Net_poll. It's return the value from 
select where it should return the equivalent of the revents and so needs 
to use FD_ISSET to check the rd/wr/ex values.

In the test then the main method doesn't need to catch IOException, it 
would be better to just let it throw it. It would also be good to make 
sure that the listener and all other sockets are closed even for the 
case that the test fails.

A few other comments on the test is that AcceptorThread.listener can be 
final. Also, are you missing a test for ServerSocket.setSoTimeout?

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the nio-dev mailing list