DefaultAttribute Class — netty Architecture
Architecture documentation for the DefaultAttribute class in DefaultAttributeMap.java from the netty codebase.
Entity Profile
Dependency Diagram
graph TD 3734b990_23e7_ebb8_3219_18560e17805c["DefaultAttribute"] a739a013_f627_e3c4_7939_617f92c79d55["DefaultAttributeMap.java"] 3734b990_23e7_ebb8_3219_18560e17805c -->|defined in| a739a013_f627_e3c4_7939_617f92c79d55 260280c7_abd2_e9d3_d420_7ee85a5c78e0["DefaultAttribute()"] 3734b990_23e7_ebb8_3219_18560e17805c -->|method| 260280c7_abd2_e9d3_d420_7ee85a5c78e0 08b08571_4145_df8d_c6bf_147379e2e4cd["key()"] 3734b990_23e7_ebb8_3219_18560e17805c -->|method| 08b08571_4145_df8d_c6bf_147379e2e4cd df51fb47_9165_8cd5_37d9_8d9fbf328c27["isRemoved()"] 3734b990_23e7_ebb8_3219_18560e17805c -->|method| df51fb47_9165_8cd5_37d9_8d9fbf328c27 e79923e5_1383_ceb7_f108_ad03f3c2377a["T()"] 3734b990_23e7_ebb8_3219_18560e17805c -->|method| e79923e5_1383_ceb7_f108_ad03f3c2377a 83eed009_0ae8_ac28_a205_e64e4eec83a1["remove()"] 3734b990_23e7_ebb8_3219_18560e17805c -->|method| 83eed009_0ae8_ac28_a205_e64e4eec83a1
Relationship Graph
Source Code
common/src/main/java/io/netty/util/DefaultAttributeMap.java lines 156–212
@SuppressWarnings("serial")
private static final class DefaultAttribute<T> extends AtomicReference<T> implements Attribute<T> {
private static final AtomicReferenceFieldUpdater<DefaultAttribute, DefaultAttributeMap> MAP_UPDATER =
AtomicReferenceFieldUpdater.newUpdater(DefaultAttribute.class,
DefaultAttributeMap.class, "attributeMap");
private static final long serialVersionUID = -2661411462200283011L;
private volatile DefaultAttributeMap attributeMap;
private final AttributeKey<T> key;
DefaultAttribute(DefaultAttributeMap attributeMap, AttributeKey<T> key) {
this.attributeMap = attributeMap;
this.key = key;
}
@Override
public AttributeKey<T> key() {
return key;
}
private boolean isRemoved() {
return attributeMap == null;
}
@Override
public T setIfAbsent(T value) {
while (!compareAndSet(null, value)) {
T old = get();
if (old != null) {
return old;
}
}
return null;
}
@Override
public T getAndRemove() {
final DefaultAttributeMap attributeMap = this.attributeMap;
final boolean removed = attributeMap != null && MAP_UPDATER.compareAndSet(this, attributeMap, null);
T oldValue = getAndSet(null);
if (removed) {
attributeMap.removeAttributeIfMatch(key, this);
}
return oldValue;
}
@Override
public void remove() {
final DefaultAttributeMap attributeMap = this.attributeMap;
final boolean removed = attributeMap != null && MAP_UPDATER.compareAndSet(this, attributeMap, null);
set(null);
if (removed) {
attributeMap.removeAttributeIfMatch(key, this);
}
}
}
Source
Frequently Asked Questions
What is the DefaultAttribute class?
DefaultAttribute is a class in the netty codebase, defined in common/src/main/java/io/netty/util/DefaultAttributeMap.java.
Where is DefaultAttribute defined?
DefaultAttribute is defined in common/src/main/java/io/netty/util/DefaultAttributeMap.java at line 156.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free