cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r1004300 - /cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java
Date Mon, 04 Oct 2010 15:50:56 GMT
Author: jbellis
Date: Mon Oct  4 15:50:56 2010
New Revision: 1004300

URL: http://svn.apache.org/viewvc?rev=1004300&view=rev
Log:
r/m unnecessary sort from Gossiper.getMaxEndpointStateVersion.  patch by iryoung jeong; reviewed
by jbellis for CASSANDRA-1570

Modified:
    cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java

Modified: cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java
URL: http://svn.apache.org/viewvc/cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java?rev=1004300&r1=1004299&r2=1004300&view=diff
==============================================================================
--- cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java (original)
+++ cassandra/trunk/src/java/org/apache/cassandra/gms/Gossiper.java Mon Oct  4 15:50:56 2010
@@ -196,22 +196,12 @@ public class Gossiper implements IFailur
             isAlive(endpoint, epState, false);
         }
     }
-
+    
     int getMaxEndpointStateVersion(EndpointState epState)
     {
-        List<Integer> versions = new ArrayList<Integer>();
-        versions.add( epState.getHeartBeatState().getHeartBeatVersion() );
-
+        int maxVersion = epState.getHeartBeatState().getHeartBeatVersion();
         for (VersionedValue value : epState.getApplicationStateMap().values())
-        {
-            int stateVersion = value.version;
-            versions.add( stateVersion );
-        }
-
-        /* sort to get the max version to build GossipDigest for this endpoint */
-        Collections.sort(versions);
-        int maxVersion = versions.get(versions.size() - 1);
-        versions.clear();
+            maxVersion = Math.max(maxVersion,  value.version);
         return maxVersion;
     }
 



Mime
View raw message