Explorar o código

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 %!s(int64=15) %!d(string=hai) anos
pai
achega
989144a475

+ 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-519. Followerhandler should close the socket if it gets an exception on a write.
+  (mahadev via breed)
+
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "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()) {
                 LOG.error("Unexpected exception causing shutdown while sock "
                         + "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) {
             LOG.error("Unexpected exception causing shutdown", e);