RFR: 8287580: (se) CancelledKeyException during channel registration

Alan Bateman alanb at openjdk.java.net
Thu Jun 2 04:55:26 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 230:

> 228:             throw e;
> 229:         } catch (CancelledKeyException ignored) {
> 230:             keys.remove(k);

I don't think keys.remove(k) should be here. If the key has been cancelled then it will be removed from the key set when the dereg queue is processed. Did you run into a test failure that lead to adding this?

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

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


More information about the nio-dev mailing list