Trustin has discovered through his research that Selector.wakeup() can significantly impact performace of selector operations. We need to modify XNIO's NIO provider to have a configurable wakeup policy. The following options should be available:
- ALWAYS - always do a selector.wakeup().
- OTHER_THREAD - only do a selector.wakeup() if the current thread is not the selector's thread.
- NEVER - do not do a selector.wakeup().
- AUTO - try to detect (based on the VM vendor, version etc.) what the right policy is.
In addition, this policy should probably be applicable on an individual basis to modifying interest sets and adding a new channel to a selector's key set.