- java.lang.Object
-
- brave.internal.PropagationFields<K,V>
-
- brave.internal.MapPropagationFields<K,V>
-
- Type Parameters:
K- Must be immutable to ensure copy-on-write is effective.V- Must be immutable to ensure copy-on-write is effective.
public class MapPropagationFields<K,V> extends PropagationFields<K,V>
Copy-on-write keeps propagation changes in a child context from affecting its parent.Type parameters must be immutable to ensure copy-on-write branch safety. For example, if they weren't, modifications by a child span could effect its parent and siblings.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class brave.internal.PropagationFields
PropagationFields.FieldConsumer<K,V>
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedMapPropagationFields()protectedMapPropagationFields(MapPropagationFields<K,V> parent)protectedMapPropagationFields(java.util.Map<K,V> parent)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)voidforEach(PropagationFields.FieldConsumer<K,V> fieldConsumer)Invokes the consumer for every non-null field valueVget(K key)Returns the value of the field with the specified key or null if not availableinthashCode()booleanisEmpty()voidput(K key, V value)Replaces the value of the field with the specified key, ignoring if not a permitted fieldprotected voidputAllIfAbsent(PropagationFields parent)java.util.Map<K,V>toMap()for testing and default toString-
Methods inherited from class brave.internal.PropagationFields
get, put, toString
-
-
-
-
Constructor Detail
-
MapPropagationFields
protected MapPropagationFields()
-
MapPropagationFields
protected MapPropagationFields(MapPropagationFields<K,V> parent)
-
-
Method Detail
-
get
public V get(K key)
Description copied from class:PropagationFieldsReturns the value of the field with the specified key or null if not available- Specified by:
getin classPropagationFields<K,V>
-
forEach
public void forEach(PropagationFields.FieldConsumer<K,V> fieldConsumer)
Description copied from class:PropagationFieldsInvokes the consumer for every non-null field value- Specified by:
forEachin classPropagationFields<K,V>
-
put
public final void put(K key, V value)
Description copied from class:PropagationFieldsReplaces the value of the field with the specified key, ignoring if not a permitted field- Specified by:
putin classPropagationFields<K,V>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin classPropagationFields<K,V>
-
putAllIfAbsent
protected final void putAllIfAbsent(PropagationFields parent)
-
toMap
public final java.util.Map<K,V> toMap()
Description copied from class:PropagationFieldsfor testing and default toString- Specified by:
toMapin classPropagationFields<K,V>
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
equals
public boolean equals(java.lang.Object o)
- Overrides:
equalsin classjava.lang.Object
-
-