浏览代码

ZOOKEEPER-519. Followerhandler should close the socket if it gets an exception on a write.

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@881847 13f79535-47bb-0310-9956-ffa450edef68
Benjamin Reed 15 年之前
父节点
当前提交
989144a475
共有 2 个文件被更改,包括 10 次插入0 次删除
  1. 3 0
      CHANGES.txt
  2. 7 0
      src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java

+ 3 - 0
CHANGES.txt

@@ -117,6 +117,9 @@ BUGFIXES:
 
 
   ZOOKEEPER-532. java compiler should be target Java 1.5 (hiram chirino and phunt via breed)
   ZOOKEEPER-532. java compiler should be target Java 1.5 (hiram chirino and phunt via breed)
 
 
+  ZOOKEEPER-519. Followerhandler should close the socket if it gets an exception on a write.
+  (mahadev via breed)
+
 IMPROVEMENTS:
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "socket reuse" and failure to close client (phunt via mahadev)
   "socket reuse" and failure to close client (phunt via mahadev)

+ 7 - 0
src/java/main/org/apache/zookeeper/server/quorum/LearnerHandler.java

@@ -420,6 +420,13 @@ public class LearnerHandler extends Thread {
             if (sock != null && !sock.isClosed()) {
             if (sock != null && !sock.isClosed()) {
                 LOG.error("Unexpected exception causing shutdown while sock "
                 LOG.error("Unexpected exception causing shutdown while sock "
                         + "still open", e);
                         + "still open", e);
+            	//close the socket to make sure the 
+            	//other side can see it being close
+            	try {
+            		sock.close();
+            	} catch(IOException ie) {
+            		// do nothing
+            	}
             }
             }
         } catch (InterruptedException e) {
         } catch (InterruptedException e) {
             LOG.error("Unexpected exception causing shutdown", e);
             LOG.error("Unexpected exception causing shutdown", e);