Potential fix for NPE in NioWorker.RegisterTask.run()
This commit is contained in:
parent
cd3acef9e1
commit
9aed1addb1
@ -93,7 +93,9 @@ class NioWorker implements Runnable {
|
|||||||
if (firstChannel) {
|
if (firstChannel) {
|
||||||
boolean success = false;
|
boolean success = false;
|
||||||
try {
|
try {
|
||||||
this.selector = selector = Selector.open();
|
synchronized (shutdownLock) {
|
||||||
|
this.selector = selector = Selector.open();
|
||||||
|
}
|
||||||
success = true;
|
success = true;
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new ChannelException(
|
throw new ChannelException(
|
||||||
@ -176,6 +178,7 @@ class NioWorker implements Runnable {
|
|||||||
|
|
||||||
synchronized (shutdownLock) {
|
synchronized (shutdownLock) {
|
||||||
if (registerTaskQueue.isEmpty() && selector.keys().isEmpty()) {
|
if (registerTaskQueue.isEmpty() && selector.keys().isEmpty()) {
|
||||||
|
started.set(false);
|
||||||
try {
|
try {
|
||||||
selector.close();
|
selector.close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@ -184,7 +187,6 @@ class NioWorker implements Runnable {
|
|||||||
} finally {
|
} finally {
|
||||||
this.selector = null;
|
this.selector = null;
|
||||||
}
|
}
|
||||||
started.set(false);
|
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
shutdown = false;
|
shutdown = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user