Callback Based Selectors

Alan Bateman Alan.Bateman at oracle.com
Wed Mar 28 20:15:59 UTC 2018


On 28/03/2018 19:22, David Lloyd wrote:
> :
> OK!  Here's a v1 pass which just includes the base methods on
> SelectionKey (attached and [1]).
>
> Unfortunately, it looks like some nontrivial surgery would be
> necessary after all before these could be fully implemented with
> atomics in a correct way, due to
> sun.nio.ch.SelChImpl#translateAndSetInterestOps() being required for a
> change to take full effect, so I can look again once your
> nioInterestOps change is in.
I don't think there is an issue there as a sequence of callings to 
interestOpsXXX will just queue the translation of the interest ops. 
However, I agree it will be a bit simpler once the changes for 
JDK-8200257 are in.

>
> BTW, it looks like nioInterestOps(int) is no longer called outside of
> SelectionKey now; maybe it can/should be inlined into
> sun.nio.ch.SelectionKeyImpl#interestOps(int)?
The nioXXX methods are to allow access easy interest or ready ops in the 
implementation. You are right that nioInterestOps isn't used outside of 
SKI now but it may be inlined anyway. I don't object to rolling it into 
interestOps of course, it just might need to be split out again if we 
need it in the implementation.

-Alan


More information about the nio-dev mailing list