Forráskód Böngészése

ZOOKEEPER-647. hudson failure in testLeaderShutdown (flavio via mahadev)

git-svn-id: https://svn.apache.org/repos/asf/hadoop/zookeeper/trunk@901510 13f79535-47bb-0310-9956-ffa450edef68
Mahadev Konar 15 éve
szülő
commit
773ed4078c

+ 2 - 0
CHANGES.txt

@@ -202,6 +202,8 @@ BUGFIXES:
   ZOOKEEPER-608. Receipt of ACK from observer should not be logged as ERROR
   (henry via mahadev)
 
+  ZOOKEEPER-647. hudson failure in testLeaderShutdown (flavio via mahadev)
+
 IMPROVEMENTS:
   ZOOKEEPER-473. cleanup junit tests to eliminate false positives due to
   "socket reuse" and failure to close client (phunt via mahadev)

+ 22 - 23
src/java/main/org/apache/zookeeper/server/quorum/QuorumCnxManager.java

@@ -560,33 +560,32 @@ public class QuorumCnxManager {
                 this.finish();
             }
             
-            while (running && !shutdown && channel != null) {
+            try {
+                while (running && !shutdown && channel != null) {
 
-                ByteBuffer b = null;
-                try {
-                    ArrayBlockingQueue<ByteBuffer> bq = queueSendMap.get(sid);                    
-                    if(bq != null) 
-                        b = bq.poll(1000, TimeUnit.MILLISECONDS);
-                    else {
-                        LOG.error("No queue of incoming messages for server " + sid);
-                        this.finish();
-                    }
-                } catch (InterruptedException e) {
-                    LOG.warn("Interrupted while waiting for message on queue",
-                            e);
-                    continue;
-                }
-                
-                try {
-                    if(b != null){
-                        lastMessageSent.put(sid, b);
-                        send(b);
+                    ByteBuffer b = null;
+                    try {
+                        ArrayBlockingQueue<ByteBuffer> bq = queueSendMap.get(sid);                    
+                        if(bq != null) 
+                            b = bq.poll(1000, TimeUnit.MILLISECONDS);
+                        else {
+                            LOG.error("No queue of incoming messages for server " + sid);
+                            break;
+                        }
+
+                        if(b != null){
+                            lastMessageSent.put(sid, b);
+                            send(b);
+                        }
+                    } catch (InterruptedException e) {
+                        LOG.warn("Interrupted while waiting for message on queue",
+                                e);
                     }
-                } catch (Exception e) {
-                    LOG.warn("Exception when using channel: " + sid, e);
-                    this.finish();
                 }
+            } catch (Exception e) {
+                LOG.warn("Exception when using channel: " + sid, e);
             }
+            this.finish();
             LOG.warn("Send worker leaving thread");
         }
     }