package datadog.trace.bootstrap; /** Instrumentation Context API */ public class InstrumentationContext { private InstrumentationContext() {} /** * Fetch a context instance out of the context store. * *
* *
Conceptually, this can be thought of as a two pass map look up. * *
For example: RunnableState runnableState = get(runnableImpl, Runnable.class, * RunnableState.class) --> RunnableState runnableState = (RunnableState) * GlobalContextMap.get(Runnable.class).get(runnableImpl) * *
* *
However, the implementation is actually provided by bytecode transformation for performance * reasons. * *
* *
Context classes are weakly referenced and will be garbage collected when their corresponding * user instance is collected. * *
* *
Instrumenters making this call must define the user-context class relationship in
* datadog.trace.agent.tooling.Instrumenter.Default#contextStore.
*
* @param userInstance The instance to store context on.
* @param userClass The user class context is attached to.
* @param contextClass The context class attached to the user class.
* @param