cassandra-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stefa...@apache.org
Subject [06/41] cassandra git commit: Revert "Reduce contention getting instances of CompositeType"
Date Mon, 25 Jul 2016 00:47:22 GMT
Revert "Reduce contention getting instances of CompositeType"

This reverts commit fda3d8ee25adc4837bb5754f718062e522c04788.

(See thread at https://mail-archives.apache.org/mod_mbox/cassandra-dev/201607.mbox/%3CCALdd-zjg%2Ba73VncPkU2rw_UpFPVsw0yNwO-yBqUQfK8H8FpiKw%40mail.gmail.com%3E)


Project: http://git-wip-us.apache.org/repos/asf/cassandra/repo
Commit: http://git-wip-us.apache.org/repos/asf/cassandra/commit/ba068472
Tree: http://git-wip-us.apache.org/repos/asf/cassandra/tree/ba068472
Diff: http://git-wip-us.apache.org/repos/asf/cassandra/diff/ba068472

Branch: refs/heads/trunk
Commit: ba068472b33dc4e68aeb05deb480811b37582a46
Parents: e865e88
Author: Jonathan Ellis <jbellis@apache.org>
Authored: Thu Jul 21 10:17:31 2016 -0500
Committer: Jonathan Ellis <jbellis@apache.org>
Committed: Thu Jul 21 10:17:31 2016 -0500

----------------------------------------------------------------------
 CHANGES.txt                                     |  1 +
 .../cassandra/db/marshal/CompositeType.java     | 20 ++++++++------------
 2 files changed, 9 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cassandra/blob/ba068472/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index b1dcbe1..d29feea 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -3,6 +3,7 @@
  * Reduce contention getting instances of CompositeType (CASSANDRA-10433)
  * Improve digest calculation in the presence of overlapping tombstones (CASSANDRA-11349)
 
+
 2.1.15
  * Account for partition deletions in tombstone histogram (CASSANDRA-12112)
  * Avoid stalling paxos when the paxos state expires (CASSANDRA-12043)

http://git-wip-us.apache.org/repos/asf/cassandra/blob/ba068472/src/java/org/apache/cassandra/db/marshal/CompositeType.java
----------------------------------------------------------------------
diff --git a/src/java/org/apache/cassandra/db/marshal/CompositeType.java b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
index d25336d..f8ac22d 100644
--- a/src/java/org/apache/cassandra/db/marshal/CompositeType.java
+++ b/src/java/org/apache/cassandra/db/marshal/CompositeType.java
@@ -19,18 +19,18 @@ package org.apache.cassandra.db.marshal;
 
 import java.io.IOException;
 import java.nio.ByteBuffer;
-import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
+import java.util.Map;
 
 import com.google.common.collect.ImmutableList;
 
-import org.apache.cassandra.cql3.ColumnIdentifier;
-import org.apache.cassandra.cql3.Operator;
 import org.apache.cassandra.exceptions.ConfigurationException;
 import org.apache.cassandra.exceptions.SyntaxException;
+import org.apache.cassandra.cql3.ColumnIdentifier;
+import org.apache.cassandra.cql3.Operator;
 import org.apache.cassandra.io.util.DataOutputBuffer;
 import org.apache.cassandra.serializers.MarshalException;
 import org.apache.cassandra.utils.ByteBufferUtil;
@@ -67,7 +67,7 @@ public class CompositeType extends AbstractCompositeType
     public final List<AbstractType<?>> types;
 
     // interning instances
-    private static final ConcurrentMap<List<AbstractType<?>>, CompositeType>
instances = new ConcurrentHashMap<List<AbstractType<?>>, CompositeType>();
+    private static final Map<List<AbstractType<?>>, CompositeType> instances
= new HashMap<List<AbstractType<?>>, CompositeType>();
 
     public static CompositeType getInstance(TypeParser parser) throws ConfigurationException,
SyntaxException
     {
@@ -97,7 +97,7 @@ public class CompositeType extends AbstractCompositeType
         return true;
     }
 
-    public static CompositeType getInstance(List<AbstractType<?>> types)
+    public static synchronized CompositeType getInstance(List<AbstractType<?>>
types)
     {
         assert types != null && !types.isEmpty();
 
@@ -105,11 +105,7 @@ public class CompositeType extends AbstractCompositeType
         if (ct == null)
         {
             ct = new CompositeType(types);
-            CompositeType previous = instances.putIfAbsent(types, ct);
-            if (previous != null)
-            {
-                ct = previous;
-            }
+            instances.put(types, ct);
         }
         return ct;
     }


Mime
View raw message