Package io.netty.util
Class DefaultAttributeMap
- java.lang.Object
-
- io.netty.util.DefaultAttributeMap
-
- All Implemented Interfaces:
AttributeMap
- Direct Known Subclasses:
AbstractChannel
,AbstractHttp2StreamChannel
public class DefaultAttributeMap extends java.lang.Object implements AttributeMap
DefaultAttributeMap
implementation which use simple synchronization per bucket to keep the memory overhead as low as possible.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
DefaultAttributeMap.DefaultAttribute<T>
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description DefaultAttributeMap()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> Attribute<T>
attr(AttributeKey<T> key)
Get theAttribute
for the givenAttributeKey
.<T> boolean
hasAttr(AttributeKey<T> key)
private static int
index(AttributeKey<?> key)
-
-
-
Field Detail
-
updater
private static final java.util.concurrent.atomic.AtomicReferenceFieldUpdater<DefaultAttributeMap,java.util.concurrent.atomic.AtomicReferenceArray> updater
-
BUCKET_SIZE
private static final int BUCKET_SIZE
- See Also:
- Constant Field Values
-
MASK
private static final int MASK
- See Also:
- Constant Field Values
-
attributes
private volatile java.util.concurrent.atomic.AtomicReferenceArray<DefaultAttributeMap.DefaultAttribute<?>> attributes
-
-
Method Detail
-
attr
public <T> Attribute<T> attr(AttributeKey<T> key)
Description copied from interface:AttributeMap
Get theAttribute
for the givenAttributeKey
. This method will never return null, but may return anAttribute
which does not have a value set yet.- Specified by:
attr
in interfaceAttributeMap
-
hasAttr
public <T> boolean hasAttr(AttributeKey<T> key)
Description copied from interface:AttributeMap
- Specified by:
hasAttr
in interfaceAttributeMap
-
index
private static int index(AttributeKey<?> key)
-
-