RFR: 8287580: (se) CancelledKeyException during channel registration [v3]

Alan Bateman alanb at openjdk.java.net
Fri Jun 3 07:04:35 UTC 2022


On Thu, 2 Jun 2022 12:34:17 GMT, Vyom Tewari <vtewari at openjdk.org> wrote:

>>> Hi Brian, what about adding the selection key to “keys” after we set the interesOps ? I do not see any side effect of doing this.
>> 
>> That would mean a selection key could be selected before it added to the selector's key set. So I don't think it is feasible, at least not without working through the spec implications.
>
> agreed,as soon as we set the  interestOps on key, native  system call can select the particular fd which is not yet added to the selector key set.

One suggestion is to a comment into the empty block, maybe something like "// cancelled by someone iterating over the selector's key set"

-------------

PR: https://git.openjdk.java.net/jdk/pull/8978


More information about the nio-dev mailing list