AttributeMap implementation which not exibit any blocking behaviour on attribute lookup while using a
copy-on-write approach on the modify path.O(logn) time worst-case
complexity, hence attribute::set(null) is to be preferred to remove.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private volatile DefaultAttributeMap. | |
| private static final AtomicReferenceFieldUpdater | |
| private static final DefaultAttributeMap. |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public <T> Attribute | attr(AttributeKey<T> key)
Implements io. Attribute for the given AttributeKey.
|
| public <T> boolean | hasAttr(AttributeKey<T> key)
Implements io. true if and only if the given Attribute exists in this AttributeMap.
|
| private static void | orderedCopyOnInsert(DefaultAttributeMap.
|
| private <T> void | |
| private static int | searchAttributeByKey(DefaultAttributeMap.
Similarly to |
| attributes | back to summary |
|---|---|
| private volatile DefaultAttributeMap. | |
| ATTRIBUTES_UPDATER | back to summary |
|---|---|
| private static final AtomicReferenceFieldUpdater<DefaultAttributeMap, DefaultAttributeMap. | |
| EMPTY_ATTRIBUTES | back to summary |
|---|---|
| private static final DefaultAttributeMap. | |
| DefaultAttributeMap | back to summary |
|---|---|
| public DefaultAttributeMap() | |
| attr | back to summary |
|---|---|
| public <T> Attribute Implements io. Doc from io. Get the
| |
| hasAttr | back to summary |
|---|---|
| public <T> boolean hasAttr(AttributeKey<T> key) Implements io. Doc from io. Returns
| |
| orderedCopyOnInsert | back to summary |
|---|---|
| private static void orderedCopyOnInsert(DefaultAttributeMap. | |
| removeAttributeIfMatch | back to summary |
|---|---|
| private <T> void removeAttributeIfMatch(AttributeKey<T> key, DefaultAttributeMap. | |
| searchAttributeByKey | back to summary |
|---|---|
| private static int searchAttributeByKey(DefaultAttributeMap. Similarly to | |
| Modifier and Type | Field and Description |
|---|---|
| private volatile DefaultAttributeMap | |
| private final AttributeKey | |
| private static final AtomicReferenceFieldUpdater | |
| private static final long |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public T | getAndRemove()
Implements io. AttributeMap and returns the old value.
|
| private boolean | |
| public AttributeKey | |
| public void | |
| public T | setIfAbsent(T value)
Implements io. Attribute's value is null.
|
| attributeMap | back to summary |
|---|---|
| private volatile DefaultAttributeMap attributeMap | |
| key | back to summary |
|---|---|
| private final AttributeKey<T> key | |
| MAP_UPDATER | back to summary |
|---|---|
| private static final AtomicReferenceFieldUpdater<DefaultAttributeMap. | |
| serialVersionUID | back to summary |
|---|---|
| private static final long serialVersionUID Hides java. | |
| DefaultAttribute | back to summary |
|---|---|
| pack-priv DefaultAttribute(DefaultAttributeMap attributeMap, AttributeKey<T> key) | |
| getAndRemove | back to summary |
|---|---|
| public T getAndRemove() Implements io. Doc from io. Removes this attribute from the
Be aware that even if you call this method another thread that has obtained a reference to this
| |
| isRemoved | back to summary |
|---|---|
| private boolean isRemoved() | |
| key | back to summary |
|---|---|
| public AttributeKey Implements io. Doc from io. Returns the key of this attribute.
| |
| remove | back to summary |
|---|---|
| public void remove() Implements io. Doc from io. Removes this attribute from the
Be aware that even if you call this method another thread that has obtained a reference to this
| |
| setIfAbsent | back to summary |
|---|---|
| public T setIfAbsent(T value) Implements io. Doc from io. Atomically sets to the given value if this
| |