You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@zookeeper.apache.org by GitBox <gi...@apache.org> on 2019/12/20 17:36:38 UTC

[GitHub] [zookeeper] lvfangmin commented on a change in pull request #1115: ZOOKEEPER-3574: Close quorum socket asynchronously to avoid server sh…

lvfangmin commented on a change in pull request #1115: ZOOKEEPER-3574: Close quorum socket asynchronously to avoid server sh…
URL: https://github.com/apache/zookeeper/pull/1115#discussion_r360485409
 
 

 ##########
 File path: zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java
 ##########
 @@ -780,12 +787,25 @@ boolean isRunning() {
     }
 
     void closeSocket() {
-        try {
-            if (sock != null) {
+        if (closeSocketAsync) {
+            final Thread closingThread = new Thread(() -> closeSock(), "CloseSocketThread(sid:" + zk.getServerId());
+            closingThread.setDaemon(true);
+            closingThread.start();
+        } else {
+            closeSock();
+        }
+    }
+
+    void closeSock() {
 
 Review comment:
   Maybe change the method name to closeSocketSync will reduce the confusion.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services