|
@@ -73,7 +73,7 @@ public class NettyServerCnxn extends ServerCnxn {
|
|
|
|
|
|
NettyServerCnxnFactory factory;
|
|
NettyServerCnxnFactory factory;
|
|
boolean initialized;
|
|
boolean initialized;
|
|
-
|
|
|
|
|
|
+
|
|
NettyServerCnxn(Channel channel, ZooKeeperServer zks, NettyServerCnxnFactory factory) {
|
|
NettyServerCnxn(Channel channel, ZooKeeperServer zks, NettyServerCnxnFactory factory) {
|
|
this.channel = channel;
|
|
this.channel = channel;
|
|
this.closingChannel = false;
|
|
this.closingChannel = false;
|
|
@@ -83,11 +83,11 @@ public class NettyServerCnxn extends ServerCnxn {
|
|
this.zooKeeperSaslServer = new ZooKeeperSaslServer(factory.login);
|
|
this.zooKeeperSaslServer = new ZooKeeperSaslServer(factory.login);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void close() {
|
|
public void close() {
|
|
closingChannel = true;
|
|
closingChannel = true;
|
|
-
|
|
|
|
|
|
+
|
|
if (LOG.isDebugEnabled()) {
|
|
if (LOG.isDebugEnabled()) {
|
|
LOG.debug("close called for sessionid:0x"
|
|
LOG.debug("close called for sessionid:0x"
|
|
+ Long.toHexString(sessionId));
|
|
+ Long.toHexString(sessionId));
|
|
@@ -119,6 +119,10 @@ public class NettyServerCnxn extends ServerCnxn {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (zkServer != null) {
|
|
|
|
+ zkServer.removeCnxn(this);
|
|
|
|
+ }
|
|
|
|
+
|
|
if (channel.isOpen()) {
|
|
if (channel.isOpen()) {
|
|
// Since we don't check on the futures created by write calls to the channel complete we need to make sure
|
|
// Since we don't check on the futures created by write calls to the channel complete we need to make sure
|
|
// that all writes have been completed before closing the channel or we risk data loss
|
|
// that all writes have been completed before closing the channel or we risk data loss
|
|
@@ -174,7 +178,7 @@ public class NettyServerCnxn extends ServerCnxn {
|
|
@Override
|
|
@Override
|
|
public ChannelFuture getFuture() {return null;}
|
|
public ChannelFuture getFuture() {return null;}
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void sendResponse(ReplyHeader h, Record r, String tag)
|
|
public void sendResponse(ReplyHeader h, Record r, String tag)
|
|
throws IOException {
|
|
throws IOException {
|
|
@@ -226,7 +230,7 @@ public class NettyServerCnxn extends ServerCnxn {
|
|
*/
|
|
*/
|
|
private class SendBufferWriter extends Writer {
|
|
private class SendBufferWriter extends Writer {
|
|
private StringBuffer sb = new StringBuffer();
|
|
private StringBuffer sb = new StringBuffer();
|
|
-
|
|
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Check if we are ready to send another chunk.
|
|
* Check if we are ready to send another chunk.
|
|
* @param force force sending, even if not a full chunk
|
|
* @param force force sending, even if not a full chunk
|
|
@@ -415,7 +419,7 @@ public class NettyServerCnxn extends ServerCnxn {
|
|
public void disableRecv() {
|
|
public void disableRecv() {
|
|
disableRecvNoWait().awaitUninterruptibly();
|
|
disableRecvNoWait().awaitUninterruptibly();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
private ChannelFuture disableRecvNoWait() {
|
|
private ChannelFuture disableRecvNoWait() {
|
|
throttled = true;
|
|
throttled = true;
|
|
if (LOG.isDebugEnabled()) {
|
|
if (LOG.isDebugEnabled()) {
|
|
@@ -423,7 +427,7 @@ public class NettyServerCnxn extends ServerCnxn {
|
|
}
|
|
}
|
|
return channel.setReadable(false);
|
|
return channel.setReadable(false);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public long getOutstandingRequests() {
|
|
public long getOutstandingRequests() {
|
|
return outstandingCount.longValue();
|
|
return outstandingCount.longValue();
|