- java.lang.Object
-
- brave.internal.PropagationFields<K,V>
-
- Direct Known Subclasses:
MapPropagationFields,PredefinedPropagationFields
public abstract class PropagationFields<K,V> extends java.lang.ObjectWe need to retain propagation state extracted from headers. However, we don't know the trace identifiers, yet. In order to resolve this ordering concern, we create an object to hold extra state, and defer associating it with a span ID (viaExtraFactory.decorate(TraceContext).Implementations of this type should use copy-on-write semantics to prevent changes in a child context from affecting its parent.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interfacePropagationFields.FieldConsumer<K,V>
-
Constructor Summary
Constructors Constructor Description PropagationFields()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract voidforEach(PropagationFields.FieldConsumer<K,V> consumer)Invokes the consumer for every non-null field valuestatic <K,V>
Vget(TraceContext context, K key, java.lang.Class<? extends PropagationFields<K,V>> type)Returns the value of the field with the specified key or null if not availableabstract Vget(K key)Returns the value of the field with the specified key or null if not availableabstract booleanisEmpty()static <K,V>
voidput(TraceContext context, K key, V value, java.lang.Class<? extends PropagationFields<K,V>> type)Replaces the value of the field with the specified key, ignoring if not a permitted fieldabstract voidput(K key, V value)Replaces the value of the field with the specified key, ignoring if not a permitted fieldprotected abstract java.util.Map<K,V>toMap()for testing and default toStringjava.lang.StringtoString()
-
-
-
Method Detail
-
get
public abstract V get(K key)
Returns the value of the field with the specified key or null if not available
-
put
public abstract void put(K key, V value)
Replaces the value of the field with the specified key, ignoring if not a permitted field
-
forEach
public abstract void forEach(PropagationFields.FieldConsumer<K,V> consumer)
Invokes the consumer for every non-null field value
-
isEmpty
public abstract boolean isEmpty()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
get
public static <K,V> V get(TraceContext context, K key, java.lang.Class<? extends PropagationFields<K,V>> type)
Returns the value of the field with the specified key or null if not available
-
put
public static <K,V> void put(TraceContext context, K key, V value, java.lang.Class<? extends PropagationFields<K,V>> type)
Replaces the value of the field with the specified key, ignoring if not a permitted field
-
-