Callback Based Selectors
Alan Bateman
Alan.Bateman at oracle.com
Mon Mar 19 18:39:01 UTC 2018
On 19/03/2018 16:23, David Lloyd wrote:
> :
> One thing worth noting is that it is possible for the callback code to
> temporarily release the lock by calling Object.wait on the selector
> instance. I think that your reentrancy guard will protect against any
> problems that could result - in fact this may in the end become a
> desirable technique, for certain specific cases at least - but I
> wanted to make sure that it was specifically called out to make sure
> it doesn't get forgotten.
Good, this is something that would need to considered too, and tested.
>
> One other thing I was wondering is whether it might be a good idea to
> process cancelled keys *after* the selection callbacks are complete,
> either in addition to or instead of processing after selection but
> before the callbacks are called? I think it would not be unusual for
> a callback to cancel selection key(s) during the course of its
> processing.
Maybe although if select is called in a loop then it will be
deregistered almost immediately anyway.
-Alan
More information about the nio-dev
mailing list