yfxhust commented on a change in pull request #1235: ZOOKEEPER-3706:
ZooKeeper.close() would leak SendThread when the netw…
URL: https://github.com/apache/zookeeper/pull/1235#discussion_r379962719
##########
File path: zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
##########
@@ -971,10 +980,20 @@ void readResponse(ByteBuffer incomingBuffer) throws
IOException {
*
* @return
*/
- ZooKeeper.States getZkState() {
+ synchronized ZooKeeper.States getZkState() {
return state;
}
+ synchronized void setZkState(ZooKeeper.States newState) throws
IOException {
+ if (!state.isAlive()) {
+ if (newState == States.CONNECTING) {
+ throw new IOException(
Review comment:
Current implementation seems more structural for future evaluation because
it will handle more scenarios.
But anyway I accept your suggestion. Currently your suggestion seems more
compact.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services