Fix race-condition which could lead to a NPE or Exception while register a Channel with a Worker. See #469
This commit is contained in:
parent
c059d13108
commit
54ad935ec5
@ -143,14 +143,17 @@ abstract class AbstractNioWorker implements Worker {
|
|||||||
assert offered;
|
assert offered;
|
||||||
|
|
||||||
if (wakenUp.compareAndSet(false, true)) {
|
if (wakenUp.compareAndSet(false, true)) {
|
||||||
// wake up the selector to speed things
|
synchronized (startStopLock) {
|
||||||
selector = this.selector;
|
// wake up the selector to speed things
|
||||||
|
selector = this.selector;
|
||||||
|
|
||||||
// Check if the selector is not null to prevent NPE if selector was
|
// Check if the selector is not null to prevent NPE if selector was
|
||||||
// set to null from another thread. See #469
|
// set to null from another thread. See #469
|
||||||
if (selector != null) {
|
if (selector != null) {
|
||||||
selector.wakeup();
|
selector.wakeup();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user