Author: jbellis
Date: Thu Apr  2 22:29:09 2009
New Revision: 761451

URL: http://svn.apache.org/viewvc?rev=761451&view=rev
Log:
use ConcurrentHashMap to simplify ugly loop (normal HashMap you cannot delete 
from during iteration)

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java

Modified: 
incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java
URL: 
http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java?rev=761451&r1=761450&r2=761451&view=diff
==============================================================================
--- 
incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java 
(original)
+++ 
incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java 
Thu Apr  2 22:29:09 2009
@@ -33,6 +33,7 @@
 import java.util.Arrays;
 import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Future;
+import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicReference;
@@ -712,7 +713,7 @@
      */
     static Set<List<String>> getCompactionBuckets(List<String> files, long min)
     {
-       Map<List<String>, Long> buckets = new HashMap<List<String>, Long>();
+       Map<List<String>, Long> buckets = new ConcurrentHashMap<List<String>, 
Long>();
        for(String fname : files)
        {
                File f = new File(fname);
@@ -722,7 +723,7 @@
             // look for a bucket containing similar-sized files:
             // group in the same bucket if it's w/in 50% of the average for 
this bucket,
             // or this file and the bucket are all considered "small" (less 
than `min`)
-            for (List<String> bucket : new 
ArrayList<List<String>>(buckets.keySet()))
+            for (List<String> bucket : buckets.keySet())
                {
                 long averageSize = buckets.get(bucket);
                 if ((size > averageSize/2 && size < 3*averageSize/2)


Reply via email to