8200257: (se) More Selector cleanup

Alan Bateman Alan.Bateman at oracle.com
Tue Mar 27 08:00:43 UTC 2018


This is another round of improvements to the Selector implementations.

The implReg and implDereg implementations are similar in the 6 
implementations. This code can be hoisted up to SelectorImpl to avoid 
the duplication. This change means the selector key set is updated in 
one place now so it's easier to understand changes in this area.

Several of the implementations use a bit set to track if a file 
descriptor is registered or not. This is replaced by adding a field to 
the selection key for the registered ops (similar to how the poll based 
Selectors store the index into the poll array in the key).

Finally, this update brings the Windows implementation in line with the 
other implementations so that the poll array isn't change directly by 
threads registering or changing interest ops.

The webrev with the proposed changes is here:
   http://cr.openjdk.java.net/~alanb/8200257/webrev/index.html

All the tests are passing with these changes on all platforms.

-Alan


More information about the nio-dev mailing list