cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brandonwilli...@apache.org
Subject svn commit: r1053453 - /cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/TokenMetadata.java
Date Tue, 28 Dec 2010 21:49:01 GMT
Author: brandonwilliams
Date: Tue Dec 28 21:49:01 2010
New Revision: 1053453

URL: http://svn.apache.org/viewvc?rev=1053453&view=rev
Log:
Avoid synchronization in getPendingRanges.
Patch by brandonwilliams, reviewed by jbellis for
CASSANDRA-1370

Modified:
    cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/TokenMetadata.java

Modified: cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/TokenMetadata.java
URL: http://svn.apache.org/viewvc/cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/TokenMetadata.java?rev=1053453&r1=1053452&r2=1053453&view=diff
==============================================================================
--- cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/TokenMetadata.java
(original)
+++ cassandra/branches/cassandra-0.6/src/java/org/apache/cassandra/locator/TokenMetadata.java
Tue Dec 28 21:49:01 2010
@@ -319,13 +319,15 @@ public class TokenMetadata
         }
     }
 
-    private synchronized Multimap<Range, InetAddress> getPendingRangesMM(String table)
+    private Multimap<Range, InetAddress> getPendingRangesMM(String table)
     {
         Multimap<Range, InetAddress> map = pendingRanges.get(table);
         if (map == null)
         {
-             map = HashMultimap.create();
-            pendingRanges.put(table, map);
+            map = HashMultimap.create();
+            Multimap<Range, InetAddress> newmap = pendingRanges.putIfAbsent(table,
map);
+            if (newmap != null)
+                map = newmap;
         }
         return map;
     }



Mime
View raw message