mirror of https://github.com/apache/cassandra
Revert "Reduce contention getting instances of CompositeType"
This reverts commit fda3d8ee25.
(See thread at https://mail-archives.apache.org/mod_mbox/cassandra-dev/201607.mbox/%3CCALdd-zjg%2Ba73VncPkU2rw_UpFPVsw0yNwO-yBqUQfK8H8FpiKw%40mail.gmail.com%3E)
This commit is contained in:
parent
e865e88753
commit
ba068472b3
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue