You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by ma...@apache.org on 2012/01/27 02:40:53 UTC

svn commit: r1236488 - /lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java

Author: markrmiller
Date: Fri Jan 27 01:40:52 2012
New Revision: 1236488

URL: http://svn.apache.org/viewvc?rev=1236488&view=rev
Log:
fix how we poll for the leader in this test

Modified:
    lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java

Modified: lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java?rev=1236488&r1=1236487&r2=1236488&view=diff
==============================================================================
--- lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java (original)
+++ lucene/dev/trunk/solr/core/src/test/org/apache/solr/cloud/LeaderElectionIntegrationTest.java Fri Jan 27 01:40:52 2012
@@ -34,7 +34,6 @@ import org.apache.solr.common.cloud.ZkNo
 import org.apache.solr.common.cloud.ZkStateReader;
 import org.apache.solr.core.CoreContainer;
 import org.apache.solr.core.CoreContainer.Initializer;
-import org.apache.solr.core.SolrConfig;
 import org.apache.zookeeper.KeeperException;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
@@ -216,23 +215,12 @@ public class LeaderElectionIntegrationTe
     //Thread.sleep(100000);
   }
   
-  private String getLeader() throws InterruptedException {
-    String leader = null;
-    int tries = 30;
-    while (tries-- > 0) {
-      ZkNodeProps props;
-      try {
-        reader.updateCloudState(true);
-        props = reader.getLeaderProps("collection1", "shard1", 500);
-        leader = props.get(ZkStateReader.NODE_NAME_PROP);
-        if (leader != null) {
-          break;
-        }
-      } catch (KeeperException e) {
-        // ignore
-      }
-      Thread.sleep(500);
-    }
+  private String getLeader() throws InterruptedException, KeeperException {
+    
+    reader.updateCloudState(true);
+    ZkNodeProps props = reader.getLeaderProps("collection1", "shard1", 15000);
+    String leader = props.get(ZkStateReader.NODE_NAME_PROP);
+    
     return leader;
   }