Potential fix for NPE during SocketChannel.register(..)
This commit is contained in:
parent
b15fe51e95
commit
486218ab28
@ -89,11 +89,14 @@ class NioWorker implements Runnable {
|
|||||||
boolean firstChannel = started.compareAndSet(false, true);
|
boolean firstChannel = started.compareAndSet(false, true);
|
||||||
Selector selector;
|
Selector selector;
|
||||||
if (firstChannel) {
|
if (firstChannel) {
|
||||||
|
selectorGuard.writeLock().lock();
|
||||||
try {
|
try {
|
||||||
this.selector = selector = Selector.open();
|
this.selector = selector = Selector.open();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ChannelException(
|
throw new ChannelException(
|
||||||
"Failed to create a selector.", e);
|
"Failed to create a selector.", e);
|
||||||
|
} finally {
|
||||||
|
selectorGuard.writeLock().unlock();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
selector = this.selector;
|
selector = this.selector;
|
||||||
|
Loading…
Reference in New Issue
Block a user