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
DefaultAttributeMapimplementation 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 classDefaultAttributeMap.DefaultAttribute<T>
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.atomic.AtomicReferenceArray<DefaultAttributeMap.DefaultAttribute<?>>attributesprivate static intBUCKET_SIZEprivate static intMASKprivate 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 theAttributefor the givenAttributeKey.<T> booleanhasAttr(AttributeKey<T> key)private static intindex(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:AttributeMapGet theAttributefor the givenAttributeKey. This method will never return null, but may return anAttributewhich does not have a value set yet.- Specified by:
attrin interfaceAttributeMap
-
hasAttr
public <T> boolean hasAttr(AttributeKey<T> key)
Description copied from interface:AttributeMap- Specified by:
hasAttrin interfaceAttributeMap
-
index
private static int index(AttributeKey<?> key)
-
-