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_r373916473
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/ClientCnxn.java
 ##########
 @@ -1121,6 +1125,9 @@ private void startConnect(InetSocketAddress addr) throws 
IOException {
                     LOG.warn("Unexpected exception", e);
                 }
             }
+            if (!state.isAlive()) {
+                throw new RuntimeException("Already closed");
+            }
 
 Review comment:
   I prefer to RuntimeException. In my opinion, IOException indicates the 
actual physical network is broken. But I think it is not proper to throw 
IOException here. Here it is software issue that misses the state check. The 
direct reason is not a real physical network broken.  I think that throwing of 
IOException here would confuse the users. So I still prefer to use 
RuntimeException here.

----------------------------------------------------------------
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

Reply via email to