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 libraryConstructor 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()
TransitLayer
BaggageContext
.discard
in interface TransitLayer
public BaggageContext branch()
TransitLayer
branch
in interface TransitLayer
public byte[] branchBytes()
TransitLayer
branchBytes
in interface TransitLayer
public void join(BaggageContext otherContext)
TransitLayer
otherContext
into the currently active context. otherContext
should not be reused after calling this method, and should be treated as discarded.join
in interface TransitLayer
otherContext
- another baggage context, possibly nullpublic void join(java.nio.ByteBuffer serializedContext)
TransitLayer
join
in interface TransitLayer
serializedContext
- a serialized baggage context, possibly nullpublic void join(byte[] serialized, int offset, int length)
TransitLayer
join
in interface TransitLayer
public void set(BaggageContext baggage)
TransitLayer
BaggageContext
, 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 TransitLayer
baggage
- The new baggage context to activate.public void set(java.nio.ByteBuffer serializedContext)
TransitLayer
set
in interface TransitLayer
serializedContext
- a serialized baggage context, possibly nullpublic void set(byte[] serialized, int offset, int length)
TransitLayer
set
in interface TransitLayer
serialized
- a serialized baggage context, possibly nulloffset
- offset into the byte arraylength
- length of serialized bytespublic BaggageContext take()
TransitLayer
BaggageContext
. After calling this method, there will be no active
BaggageContext
.take
in interface TransitLayer
BaggageContext
.public byte[] takeBytes()
TransitLayer
BaggageContext
. After calling this method, there will
be no active BaggageContext
.takeBytes
in interface TransitLayer
BaggageContext
.public BaggageContext peek()
TransitLayer
BaggageContext
. 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 TransitLayer
BaggageContext
public void update(BaggageContext baggage)
TransitLayer
BaggageContext
. 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