|
@@ -698,11 +698,6 @@ public class NIOServerCnxnFactory extends ServerCnxnFactory {
|
|
public void reconfigure(InetSocketAddress addr) {
|
|
public void reconfigure(InetSocketAddress addr) {
|
|
ServerSocketChannel oldSS = ss;
|
|
ServerSocketChannel oldSS = ss;
|
|
try {
|
|
try {
|
|
- this.ss = ServerSocketChannel.open();
|
|
|
|
- ss.socket().setReuseAddress(true);
|
|
|
|
- LOG.info("binding to port " + addr);
|
|
|
|
- ss.socket().bind(addr);
|
|
|
|
- ss.configureBlocking(false);
|
|
|
|
acceptThread.setReconfiguring();
|
|
acceptThread.setReconfiguring();
|
|
tryClose(oldSS);
|
|
tryClose(oldSS);
|
|
acceptThread.wakeupSelector();
|
|
acceptThread.wakeupSelector();
|
|
@@ -713,6 +708,11 @@ public class NIOServerCnxnFactory extends ServerCnxnFactory {
|
|
e.getMessage());
|
|
e.getMessage());
|
|
Thread.currentThread().interrupt();
|
|
Thread.currentThread().interrupt();
|
|
}
|
|
}
|
|
|
|
+ this.ss = ServerSocketChannel.open();
|
|
|
|
+ ss.socket().setReuseAddress(true);
|
|
|
|
+ LOG.info("binding to port " + addr);
|
|
|
|
+ ss.socket().bind(addr);
|
|
|
|
+ ss.configureBlocking(false);
|
|
acceptThread = new AcceptThread(ss, addr, selectorThreads);
|
|
acceptThread = new AcceptThread(ss, addr, selectorThreads);
|
|
acceptThread.start();
|
|
acceptThread.start();
|
|
} catch(IOException e) {
|
|
} catch(IOException e) {
|
|
@@ -878,13 +878,21 @@ public class NIOServerCnxnFactory extends ServerCnxnFactory {
|
|
}
|
|
}
|
|
|
|
|
|
if (acceptThread != null) {
|
|
if (acceptThread != null) {
|
|
- acceptThread.wakeupSelector();
|
|
|
|
|
|
+ if (acceptThread.isAlive()) {
|
|
|
|
+ acceptThread.wakeupSelector();
|
|
|
|
+ } else {
|
|
|
|
+ acceptThread.closeSelector();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (expirerThread != null) {
|
|
if (expirerThread != null) {
|
|
expirerThread.interrupt();
|
|
expirerThread.interrupt();
|
|
}
|
|
}
|
|
for (SelectorThread thread : selectorThreads) {
|
|
for (SelectorThread thread : selectorThreads) {
|
|
- thread.wakeupSelector();
|
|
|
|
|
|
+ if (thread.isAlive()) {
|
|
|
|
+ thread.wakeupSelector();
|
|
|
|
+ } else {
|
|
|
|
+ thread.closeSelector();
|
|
|
|
+ }
|
|
}
|
|
}
|
|
if (workerPool != null) {
|
|
if (workerPool != null) {
|
|
workerPool.stop();
|
|
workerPool.stop();
|