RFR: 8287580: (se) CancelledKeyException during channel registration

Brian Burkhalter bpb at openjdk.java.net
Thu Jun 2 14:54:35 UTC 2022


On Thu, 2 Jun 2022 04:51:58 GMT, Alan Bateman <alanb 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?

No failure, it was for symmetry with the other catch block; will remove.

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

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


More information about the nio-dev mailing list