Commit 26e85615 authored by Jonathan Mace's avatar Jonathan Mace

Add no-op BaggageContext implementation

parent 9543024a
# No-Op BaggageContext Impl
Provides a no-op implementation of the `BaggageContext` and `BaggageProvider` interfaces. Every propagation method just returns null.
Having a no-op baggage implementation is useful at instrumentation time, because you can instrument your systems and compile them without yet deciding on the actual `BaggageProvider` implementation you wish to use.
\ No newline at end of file
package brown.tracingplane.noopprovider;
import java.nio.ByteBuffer;
import brown.tracingplane.BaggageContext;
import brown.tracingplane.BaggageProvider;
/**
* A {@link BaggageProvider} implementation that always just returns null.
*/
public class NoOpBaggageContextProvider implements BaggageProvider<BaggageContext> {
@Override
public BaggageContext newInstance() {
return null;
}
@Override
public void discard(BaggageContext baggage) {}
@Override
public BaggageContext branch(BaggageContext from) {
return null;
}
@Override
public BaggageContext join(BaggageContext left, BaggageContext right) {
return null;
}
@Override
public BaggageContext deserialize(byte[] serialized, int offset, int length) {
return null;
}
@Override
public BaggageContext deserialize(ByteBuffer buf) {
return null;
}
@Override
public byte[] serialize(BaggageContext baggage) {
return null;
}
@Override
public byte[] serialize(BaggageContext baggage, int maximumSerializedSize) {
return null;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment