Netty Support / VirtualThread Selector#select Issue

Alan Bateman Alan.Bateman at oracle.com
Mon Oct 25 14:20:30 UTC 2021


On 25/10/2021 10:59, Johannes Schüth wrote:
> Hello Alan,
>
> yes - there is one eventloop per thread. That's the default behavior for
> Netty. Your feedback gave me some clues on how to adapt the implementation.
> Using a single selector with multiple threads makes more sense.
> I'm not sure why Netty is using a different approach. Maybe this is done
> this way to avoid synchronization on selection key operations (which are
> not thread safe).
It might be that you don't need to use non-blocking I/O and Selectors.

As regards the synchronization on selection keys then they have always 
been specified to be safe for use by concurrent threads. Maybe you are 
thinking about updates to the interest set needing to synchronize with 
selection operations? The spec was relaxed in Java 11 to not require 
that. Any changes to the interest set will be seen by the next selection 
operation.

-Alan


More information about the loom-dev mailing list