public class DefaultAttributeMap extends java.lang.Object implements AttributeMap
AttributeMap
implementation which use simple synchronization per bucket to keep the memory overhead
as low as possible.Modifier and Type | Class and Description |
---|---|
private static class |
DefaultAttributeMap.DefaultAttribute<T> |
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.AtomicReferenceArray<DefaultAttributeMap.DefaultAttribute<?>> |
attributes |
private static int |
BUCKET_SIZE |
private static int |
MASK |
private static java.util.concurrent.atomic.AtomicReferenceFieldUpdater<DefaultAttributeMap,java.util.concurrent.atomic.AtomicReferenceArray> |
updater |
Constructor and Description |
---|
DefaultAttributeMap() |
Modifier and Type | Method and Description |
---|---|
<T> Attribute<T> |
attr(AttributeKey<T> key)
Get the
Attribute for the given AttributeKey . |
private static int |
index(AttributeKey<?> key) |
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<DefaultAttributeMap,java.util.concurrent.atomic.AtomicReferenceArray> updater
private static final int BUCKET_SIZE
private static final int MASK
private volatile java.util.concurrent.atomic.AtomicReferenceArray<DefaultAttributeMap.DefaultAttribute<?>> attributes
public <T> Attribute<T> attr(AttributeKey<T> key)
AttributeMap
Attribute
for the given AttributeKey
. This method will never return null, but may return
an Attribute
which does not have a value set yet.attr
in interface AttributeMap
private static int index(AttributeKey<?> key)