Fixed a problem where NPE is thrown when NioWorker.write() is called too early

This commit is contained in:
Trustin Lee 2008-11-06 15:01:08 +00:00
parent 85e63a2c98
commit 22f33539c1

View File

@ -387,7 +387,10 @@ class NioWorker implements Runnable {
worker.writeTaskQueue.offer(channel.writeTask); worker.writeTaskQueue.offer(channel.writeTask);
} }
if (worker.wakenUp.compareAndSet(false, true)) { if (worker.wakenUp.compareAndSet(false, true)) {
worker.selector.wakeup(); Selector workerSelector = worker.selector;
if (workerSelector != null) {
workerSelector.wakeup();
}
} }
return; return;
} }