cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbel...@apache.org
Subject svn commit: r761804 - in /incubator/cassandra/trunk/src/org/apache/cassandra: db/ColumnFamilyStore.java db/EfficientBidiMap.java utils/Cachetable.java
Date Fri, 03 Apr 2009 21:27:37 GMT
Author: jbellis
Date: Fri Apr  3 21:27:34 2009
New Revision: 761804

URL: http://svn.apache.org/viewvc?rev=761804&view=rev
Log:
expunge ConcurrentHashMap in favor of NonBlockingHashMap.  patch by jbellis, review by johano.
 see #50

Modified:
    incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java
    incubator/cassandra/trunk/src/org/apache/cassandra/db/EfficientBidiMap.java
    incubator/cassandra/trunk/src/org/apache/cassandra/utils/Cachetable.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=761804&r1=761803&r2=761804&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/ColumnFamilyStore.java Fri Apr 
3 21:27:34 2009
@@ -23,17 +23,14 @@
 import java.math.BigInteger;
 import java.util.ArrayList;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
 import java.util.PriorityQueue;
 import java.util.Set;
 import java.util.StringTokenizer;
-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;
@@ -49,11 +46,12 @@
 import org.apache.cassandra.io.SSTable;
 import org.apache.cassandra.io.SequenceFile;
 import org.apache.cassandra.net.EndPoint;
-import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.service.PartitionerType;
+import org.apache.cassandra.service.StorageService;
 import org.apache.cassandra.utils.BloomFilter;
 import org.apache.cassandra.utils.FileUtils;
 import org.apache.cassandra.utils.LogUtil;
+import org.cliffc.high_scale_lib.NonBlockingHashMap;
 
 /**
  * Author : Avinash Lakshman ( alakshman@facebook.com) & Prashant Malik ( pmalik@facebook.com
)
@@ -702,7 +700,7 @@
      */
     static Set<List<String>> getCompactionBuckets(List<String> files, long
min)
     {
-    	Map<List<String>, Long> buckets = new ConcurrentHashMap<List<String>,
Long>();
+    	Map<List<String>, Long> buckets = new NonBlockingHashMap<List<String>,
Long>();
     	for(String fname : files)
     	{
     		File f = new File(fname);

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/db/EfficientBidiMap.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/db/EfficientBidiMap.java?rev=761804&r1=761803&r2=761804&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/db/EfficientBidiMap.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/db/EfficientBidiMap.java Fri Apr  3
21:27:34 2009
@@ -19,14 +19,12 @@
 package org.apache.cassandra.db;
 
 import java.io.Serializable;
-import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentSkipListSet;
 import java.util.Map;
 import java.util.SortedSet;
 import java.util.Comparator;
-import java.util.TreeSet;
 
-import org.apache.cassandra.db.ColumnComparatorFactory.ComparatorType;
+import org.cliffc.high_scale_lib.NonBlockingHashMap;
 
 
 /**
@@ -35,16 +33,16 @@
 
 class EfficientBidiMap implements Serializable
 {
-    private Map<String, IColumn> map_;
-    private SortedSet<IColumn> sortedSet_;
+    private NonBlockingHashMap<String, IColumn> map_;
+    private ConcurrentSkipListSet<IColumn> sortedSet_;
     private Comparator<IColumn> columnComparator_;
 
     EfficientBidiMap(Comparator<IColumn> columnComparator)
     {
-        this(new ConcurrentHashMap<String, IColumn>(), new ConcurrentSkipListSet<IColumn>(columnComparator),
columnComparator);
+        this(new NonBlockingHashMap<String, IColumn>(), new ConcurrentSkipListSet<IColumn>(columnComparator),
columnComparator);
     }
 
-    EfficientBidiMap(Map<String, IColumn> map, SortedSet<IColumn> set, Comparator<IColumn>
comparator)
+    private EfficientBidiMap(NonBlockingHashMap<String, IColumn> map, ConcurrentSkipListSet<IColumn>
set, Comparator<IColumn> comparator)
     {
     	map_ = map;
     	sortedSet_ = set;
@@ -102,9 +100,7 @@
 
     EfficientBidiMap cloneMe()
     {
-    	Map<String, IColumn> map = new ConcurrentHashMap<String, IColumn>(map_);
-    	SortedSet<IColumn> set = new ConcurrentSkipListSet<IColumn>(sortedSet_);
-    	return new EfficientBidiMap(map, set, columnComparator_);
+    	return new EfficientBidiMap((NonBlockingHashMap<String, IColumn>) map_.clone(),
sortedSet_.clone(), columnComparator_);
     }
 }
 

Modified: incubator/cassandra/trunk/src/org/apache/cassandra/utils/Cachetable.java
URL: http://svn.apache.org/viewvc/incubator/cassandra/trunk/src/org/apache/cassandra/utils/Cachetable.java?rev=761804&r1=761803&r2=761804&view=diff
==============================================================================
--- incubator/cassandra/trunk/src/org/apache/cassandra/utils/Cachetable.java (original)
+++ incubator/cassandra/trunk/src/org/apache/cassandra/utils/Cachetable.java Fri Apr  3 21:27:34
2009
@@ -19,7 +19,6 @@
 package org.apache.cassandra.utils;
 
 import java.util.*;
-import java.util.concurrent.ConcurrentHashMap;
 
 import org.apache.log4j.Logger;
 /**



Mime
View raw message