|
@@ -426,7 +426,7 @@ public class NIOServerCnxn extends ServerCnxn {
|
|
|
}
|
|
|
|
|
|
private void readConnectRequest() throws IOException, InterruptedException {
|
|
|
- if (isZKServerRunning()) {
|
|
|
+ if (!isZKServerRunning()) {
|
|
|
throw new IOException("ZooKeeperServer not running");
|
|
|
}
|
|
|
zkServer.processConnectRequest(this, incomingBuffer);
|
|
@@ -539,15 +539,18 @@ public class NIOServerCnxn extends ServerCnxn {
|
|
|
if (len < 0 || len > BinaryInputArchive.maxBuffer) {
|
|
|
throw new IOException("Len error " + len);
|
|
|
}
|
|
|
- if (isZKServerRunning()) {
|
|
|
+ if (!isZKServerRunning()) {
|
|
|
throw new IOException("ZooKeeperServer not running");
|
|
|
}
|
|
|
incomingBuffer = ByteBuffer.allocate(len);
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @return true if the server is running, false otherwise.
|
|
|
+ */
|
|
|
boolean isZKServerRunning() {
|
|
|
- return zkServer == null || !zkServer.isRunning();
|
|
|
+ return zkServer != null && zkServer.isRunning();
|
|
|
}
|
|
|
|
|
|
public long getOutstandingRequests() {
|