public class NoOpTransitLayer extends java.lang.Object implements TransitLayer
A TransitLayer that does nothing. This is the default TransitLayer implementation that will be used
in lieu of anything else. If this is the TransitLayer implementation used, the effect is that any calls to
the ActiveBaggage interface will find that there is no active baggage.
NoOpTransitLayer is typically going to be used at instrumentation time, prior to binding to a particular
implementation.
If you intend to use a different instrumentation library altogether to propagate contexts (e.g., OpenTracing), then you would either:
TransitLayer that opaquely proxies to your other instrumentation library| Constructor and Description |
|---|
NoOpTransitLayer() |
| Modifier and Type | Method and Description |
|---|---|
BaggageContext |
branch()
Create and return a branched copy of the currently active baggage context.
|
byte[] |
branchBytes()
Create and return a branched, serialized copy of the currently active baggage context.
|
void |
discard()
Discard the currently active
BaggageContext. |
void |
join(BaggageContext otherContext)
Merges the contents of
otherContext into the currently active context. |
void |
join(byte[] serialized,
int offset,
int length)
Deserializes the provided context and merges it into the currently active context.
|
void |
join(java.nio.ByteBuffer serializedContext)
Deserializes the provided context and merges it into the currently active context.
|
BaggageContext |
peek()
Gets the currently active
BaggageContext. |
void |
set(BaggageContext baggage)
Discards the currently active
BaggageContext, then activates the provided baggage. |
void |
set(byte[] serialized,
int offset,
int length)
Deserializes the provided context and merges it into the currently active context.
|
void |
set(java.nio.ByteBuffer serializedContext)
Deserializes the provided context, discards any currently active context, and replaces it with the deserialized
context.
|
BaggageContext |
take()
Gets and removes the currently active
BaggageContext. |
byte[] |
takeBytes()
Gets, removes, and serializes the currently active
BaggageContext. |
void |
update(BaggageContext baggage)
Sets the currently active
BaggageContext. |
public void discard()
TransitLayerBaggageContext.discard in interface TransitLayerpublic BaggageContext branch()
TransitLayerbranch in interface TransitLayerpublic byte[] branchBytes()
TransitLayerbranchBytes in interface TransitLayerpublic void join(BaggageContext otherContext)
TransitLayerotherContext into the currently active context. otherContext
should not be reused after calling this method, and should be treated as discarded.join in interface TransitLayerotherContext - another baggage context, possibly nullpublic void join(java.nio.ByteBuffer serializedContext)
TransitLayerjoin in interface TransitLayerserializedContext - a serialized baggage context, possibly nullpublic void join(byte[] serialized,
int offset,
int length)
TransitLayerjoin in interface TransitLayerpublic void set(BaggageContext baggage)
TransitLayerBaggageContext, then activates the provided baggage. If
baggage is just a modified version of the currently active BaggageContext, then it is better to use
the TransitLayer.update(BaggageContext) method instead.set in interface TransitLayerbaggage - The new baggage context to activate.public void set(java.nio.ByteBuffer serializedContext)
TransitLayerset in interface TransitLayerserializedContext - a serialized baggage context, possibly nullpublic void set(byte[] serialized,
int offset,
int length)
TransitLayerset in interface TransitLayerserialized - a serialized baggage context, possibly nulloffset - offset into the byte arraylength - length of serialized bytespublic BaggageContext take()
TransitLayerBaggageContext. After calling this method, there will be no active
BaggageContext.take in interface TransitLayerBaggageContext.public byte[] takeBytes()
TransitLayerBaggageContext. After calling this method, there will
be no active BaggageContext.takeBytes in interface TransitLayerBaggageContext.public BaggageContext peek()
TransitLayerBaggageContext. The BaggageContext instance remains active after
calling this method. Use TransitLayer.take() to if you wish to get and remove the currently active context.peek in interface TransitLayerBaggageContextpublic void update(BaggageContext baggage)
TransitLayerBaggageContext. A call to this method implies that the provided
context argument is an updated version of the active context. Conversely, if you intend to replace
the currently active context (e.g., because a different execution is beginning), use the
TransitLayer.set(BaggageContext) method.update in interface TransitLayer