zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From f..@apache.org
Subject svn commit: r1082178 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
Date Wed, 16 Mar 2011 15:58:35 GMT
Author: fpj
Date: Wed Mar 16 15:58:34 2011
New Revision: 1082178

URL: http://svn.apache.org/viewvc?rev=1082178&view=rev
Log:
ZOOKEEPER-993. Code improvements (MIS via fpj)


Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1082178&r1=1082177&r2=1082178&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Wed Mar 16 15:58:34 2011
@@ -188,6 +188,8 @@ BUGFIXES: 
 
   ZOOKEEPER-1007. iarchive leak in C client (jeremy stribling via mahadev)
 
+  ZOOKEEPER-993. Code improvements (MIS via fpj)
+
 IMPROVEMENTS:
   ZOOKEEPER-724. Improve junit test integration - log harness information 
   (phunt via mahadev)

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java?rev=1082178&r1=1082177&r2=1082178&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
(original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/FastLeaderElection.java
Wed Mar 16 15:58:34 2011
@@ -507,17 +507,13 @@ public class FastLeaderElection implemen
      * @param zxid  Last zxid observed by the issuer of this vote
      */
     private boolean totalOrderPredicate(long newId, long newZxid, long curId, long curZxid)
{
-        LOG.debug("id: " + newId + ", proposed id: " + curId + ", zxid: " + newZxid + ",
proposed zxid: " + curZxid);
+        LOG.debug("id: " + newId + ", proposed id: " + curId + ", zxid: " + 
+                newZxid + ", proposed zxid: " + curZxid);
         if(self.getQuorumVerifier().getWeight(newId) == 0){
             return false;
         }
-
-        if ((newZxid > curZxid)
-                || ((newZxid == curZxid) && (newId > curId)))
-            return true;
-        else
-            return false;
-
+        
+        return ((newZxid > curZxid) || ((newZxid == curZxid) && (newId > curId)));
     }
 
     /**
@@ -544,11 +540,7 @@ public class FastLeaderElection implemen
             }
         }
 
-        if(self.getQuorumVerifier().containsQuorum(set))
-            return true;
-        else
-            return false;
-
+        return self.getQuorumVerifier().containsQuorum(set);
     }
 
     /**



Mime
View raw message