I have a somewhat complex loop processing several different NIO channels and other objects. Some of these objects trigger their processing (i.e. simulate a "select"-event) by calling Selector.wakeup().
When I accidentally put my thread into a busy-loop by always calling wakeup() before every call to select(), I noticed that my other NIO channels were no longer getting serviced at all. As soon as the condition triggering the busy-loop went away, all other channels were immediately serviced again as usual.
After a bit of messing around with this I figured out that the reason for my other channels no longer being serviced was that select() did not fill the list of selectedKeys() if it returned immediately due to a pending wakeup().
Is this expected behavior? I couldn't find anything in the docs regarding this detail.
If so, is there a way to prevent this more elegantly than by following every select() with an additional selectNow()?