RFR: 8287580: (se) CancelledKeyException during channel registration
Vyom Tewari
vtewari at openjdk.java.net
Thu Jun 2 09:51:35 UTC 2022
On Wed, 1 Jun 2022 18:32:28 GMT, Brian Burkhalter <bpb at openjdk.org> wrote:
> Ignore `CancelledKeyException` during registration.
src/java.base/share/classes/sun/nio/ch/SelectorImpl.java line 229:
> 227: k.cancel();
> 228: throw e;
> 229: } catch (CancelledKeyException ignored) {
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.
// it may be observed by a thread iterating over the selector's key set.
- keys.add(k);
try {
k.interestOps(ops);
+ keys.add(k);
} catch (ClosedSelectorException e) {
-------------
PR: https://git.openjdk.java.net/jdk/pull/8978
More information about the nio-dev
mailing list