First fix for: NETTY-114 Selectors of the NIO transport are sometimes not waken up

* Made sure Selector.wakeup() is called, but it can be called more than once if unlucky. Excessive wakeups are still suppressed though.
This commit is contained in:
Trustin Lee 2009-02-01 14:50:47 +00:00
parent 9959cdd705
commit d2427cac7a
2 changed files with 14 additions and 0 deletions

View File

@ -234,6 +234,13 @@ class NioClientSocketPipelineSink extends AbstractChannelSink {
try {
int selectedKeyCount = selector.select(500);
// Wake up immediately in the next turn if someone might
// have waken up the selector between 'wakenUp.set(false)'
// and 'selector.select(...)'.
if (wakenUp.get()) {
selector.wakeup();
}
processRegisterTaskQueue();
if (selectedKeyCount > 0) {

View File

@ -155,6 +155,13 @@ class NioWorker implements Runnable {
try {
int selectedKeyCount = selector.select(500);
// Wake up immediately in the next turn if someone might
// have waken up the selector between 'wakenUp.set(false)'
// and 'selector.select(...)'.
if (wakenUp.get()) {
selector.wakeup();
}
processRegisterTaskQueue();
processWriteTaskQueue();