Moving to the nio-dev list.
Registration is not an atomic operation. The channel is registered (this
creates the selection key) and then the key's interest set is changed.
If I read your test case correctly, it is cancelling the key before the
key's interest set is changed and this leads to
Hi,
I noticed this surprising (to me) behaviour, and wonder whether it's
expected or could be considered a bug. I'm not an expert in this area so
apologies if this is trivial.
When registering a SocketChannel with a Selector for the first time,
it's possible to get a CancelledKeyException ev