zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f..@apache.org
Subject svn commit: r1551985 - in /zookeeper/branches/branch-3.4: CHANGES.txt src/java/test/org/apache/zookeeper/test/FLETest.java
Date Wed, 18 Dec 2013 15:48:20 GMT
Author: fpj
Date: Wed Dec 18 15:48:19 2013
New Revision: 1551985

URL: http://svn.apache.org/r1551985
Log:
ZOOKEEPER-1733. FLETest#testLE is flaky on windows boxes 
  (michim via fpj)

Modified:
    zookeeper/branches/branch-3.4/CHANGES.txt
    zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/FLETest.java

Modified: zookeeper/branches/branch-3.4/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/CHANGES.txt?rev=1551985&r1=1551984&r2=1551985&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/CHANGES.txt (original)
+++ zookeeper/branches/branch-3.4/CHANGES.txt Wed Dec 18 15:48:19 2013
@@ -199,6 +199,9 @@ BUGFIXES:
 
   ZOOKEEPER-1841. problem in QuorumTest (Germán via fpj)
 
+  ZOOKEEPER-1733. FLETest#testLE is flaky on windows boxes 
+  (michim via fpj)
+
 IMPROVEMENTS:
 
   ZOOKEEPER-1564. Allow JUnit test build with IBM Java

Modified: zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/FLETest.java
URL: http://svn.apache.org/viewvc/zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/FLETest.java?rev=1551985&r1=1551984&r2=1551985&view=diff
==============================================================================
--- zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/FLETest.java (original)
+++ zookeeper/branches/branch-3.4/src/java/test/org/apache/zookeeper/test/FLETest.java Wed
Dec 18 15:48:19 2013
@@ -24,6 +24,7 @@ import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Random;
+import java.util.Set;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -74,6 +75,7 @@ public class FLETest extends ZKTestCase 
     volatile long leader = -1;
     //volatile int round = 1;
     Random rand = new Random();
+    Set<Long> joinedThreads;
 
     @Before
     public void setUp() throws Exception {
@@ -87,6 +89,7 @@ public class FLETest extends ZKTestCase 
         port = new int[count];
         successCount = 0;
         finalObj = new Object();
+        joinedThreads = new HashSet<Long>();
     }
 
     @After
@@ -180,6 +183,7 @@ public class FLETest extends ZKTestCase 
                                 if(leader == i){
                                     synchronized(finalObj){
                                         successCount++;
+                                        joinedThreads.add((long)i);
                                         if(successCount > (count/2)) finalObj.notify();
                                     }
 
@@ -224,6 +228,7 @@ public class FLETest extends ZKTestCase 
                                 if (leader == votes[i].getId()) {
                                     synchronized(finalObj){
                                         successCount++;
+                                        joinedThreads.add((long)i);
                                         if(successCount > (count/2)) finalObj.notify();
                                     }
                                     break;
@@ -309,8 +314,10 @@ public class FLETest extends ZKTestCase 
            Assert.fail("Fewer than a a majority has joined");
        }
 
-       if(threads.get((int) leader).isAlive()){
-           Assert.fail("Leader hasn't joined: " + leader);
+       synchronized(finalObj){
+           if(!joinedThreads.contains(leader)){
+               Assert.fail("Leader hasn't joined: " + leader);
+           }
        }
     }
 



Mime
View raw message