Pārlūkot izejas kodu

ZOOKEEPER-121. SyncRequestProcessor is not closing log stream during shutdown (breed via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@922759 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 15 gadi atpakaļ
vecāks
revīzija
037d07cb71

+ 3 - 0
CHANGES.txt

@@ -279,6 +279,9 @@ BUGFIXES:
   ZOOKEEPER-698. intermittent JMX test failures due to not verifying QuorumPeer
   shutdown (phunt)
 
+  ZOOKEEPER-121. SyncRequestProcessor is not closing log stream during shutdown
+  (breed via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "socket reuse" and failure to close client (phunt via mahadev)

+ 7 - 2
src/java/main/org/apache/zookeeper/server/SyncRequestProcessor.java

@@ -166,12 +166,17 @@ public class SyncRequestProcessor extends Thread implements RequestProcessor {
     }
 
     public void shutdown() {
-        try{
+        queuedRequests.add(requestOfDeath);
+        try {
+            this.join();
+        } catch(InterruptedException e) {
+            LOG.warn("Interrupted while wating for " + this + " to finish");
+        }
+        try {
             zks.getZKDatabase().close();
         } catch (IOException ie) {
             LOG.warn("Error closing logs ", ie);
         }
-        queuedRequests.add(requestOfDeath);
         nextProcessor.shutdown();
     }