zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1227927 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/Leader.java src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java
Date Fri, 06 Jan 2012 01:32:59 GMT
Author: phunt
Date: Fri Jan  6 01:32:58 2012
New Revision: 1227927

URL: http://svn.apache.org/viewvc?rev=1227927&view=rev
Log:
ZOOKEEPER-1293. Remove unused readyToStart from Leader.java (Alex Shraer via phunt)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
    zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1227927&r1=1227926&r2=1227927&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Fri Jan  6 01:32:58 2012
@@ -174,6 +174,8 @@ IMPROVEMENTS:
   ZOOKEEPER-1345. Add a .gitignore file with general exclusions and
   Eclipse project files excluded (Harsh J via phunt)
 
+  ZOOKEEPER-1293. Remove unused readyToStart from Leader.java
+  (Alex Shraer via phunt)
 
 Release 3.4.0 - 
 

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java?rev=1227927&r1=1227926&r2=1227927&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java Fri Jan 
6 01:32:58 2012
@@ -75,7 +75,7 @@ public class Leader {
     final QuorumPeer self;
 
     // the follower acceptor thread
-    LearnerCnxAcceptor cnxAcceptor;
+    volatile LearnerCnxAcceptor cnxAcceptor = null;
 
     // list of all the followers
     public final HashSet<LearnerHandler> learners =
@@ -280,7 +280,6 @@ public class Leader {
 
     long epoch = -1;
     boolean waitingForNewEpoch = true;
-    volatile boolean readyToStart = false;
 
     /**
      * This method is main function that is called to lead
@@ -309,7 +308,6 @@ public class Leader {
             cnxAcceptor.setName("LearnerCnxAcceptor-" + ss.getLocalSocketAddress());
             cnxAcceptor.start();
 
-            readyToStart = true;
             long epoch = getEpochToPropose(self.getId(), self.getAcceptedEpoch());      
     
 
             zk.setZxid(ZxidUtils.makeZxid(epoch, 0));

Modified: zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java?rev=1227927&r1=1227926&r2=1227927&view=diff
==============================================================================
--- zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java (original)
+++ zookeeper/trunk/src/java/test/org/apache/zookeeper/server/quorum/Zab1_0Test.java Fri Jan
 6 01:32:58 2012
@@ -229,7 +229,6 @@ public class Zab1_0Test {
             FollowerMockThread f2 = new FollowerMockThread(2, leader, false);
 
             // things needed for waitForEpochAck to run (usually in leader.lead(), but we're
not running leader here)
-            leader.readyToStart = true;
             leader.leaderStateSummary = new StateSummary(leader.self.getCurrentEpoch(), leader.zk.getLastProcessedZxid());
             
             f1.start();
@@ -323,7 +322,7 @@ public class Zab1_0Test {
             leadThread = new LeadThread(leader);
             leadThread.start();
 
-            while(!leader.readyToStart) {
+            while(leader.cnxAcceptor == null || !leader.cnxAcceptor.isAlive()) {
                 Thread.sleep(20);
             }
             



Mime
View raw message