File tree Expand file tree Collapse file tree
components/context/src/main/java/datadog/context Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55
66import javax .annotation .Nullable ;
77
8- /** Immutable context scoped to an execution unit or carrier object. */
8+ /**
9+ * Immutable context scoped to an execution unit or carrier object.
10+ *
11+ * <p>Each element of the context is accessible by its {@link ContextKey}. Keys represents product
12+ * or functional areas and should be created sparingly. Elements in the context may themselves be
13+ * mutable.
14+ */
915public interface Context {
1016
11- /** Returns the root context. */
17+ /**
18+ * Returns the root context.
19+ *
20+ * <p>This is the initial local context that all contexts extend.
21+ */
1222 static Context root () {
1323 return manager ().root ();
1424 }
@@ -72,14 +82,14 @@ static Context detachFrom(Object carrier) {
7282 <T > T get (ContextKey <T > key );
7383
7484 /**
75- * Creates a new context with the given key-value mapping .
85+ * Creates a new context from the same elements, except the key is now mapped to the given value .
7686 *
7787 * @return New context with the key-value mapping.
7888 */
7989 <T > Context with (ContextKey <T > key , T value );
8090
8191 /**
82- * Creates a new context with a value that has its own implicit key.
92+ * Creates a new context from the same elements, except the implicit key is mapped to this value .
8393 *
8494 * @return New context with the implicitly keyed value.
8595 */
Original file line number Diff line number Diff line change 33import java .util .concurrent .atomic .AtomicInteger ;
44
55/**
6- * Key for indexing values of type {@link T} stored in a {@link Context }.
6+ * {@link Context} key that maps to a value of type {@link T }.
77 *
88 * <p>Keys are compared by identity rather than by name. Each stored context type should either
99 * share its key for re-use or implement {@link ImplicitContextKeyed} to keep its key private.
Original file line number Diff line number Diff line change 33/** Manages context across execution units. */
44public interface ContextManager {
55
6- /** Returns the root context. */
6+ /**
7+ * Returns the root context.
8+ *
9+ * <p>This is the initial local context that all contexts extend.
10+ */
711 Context root ();
812
913 /**
You can’t perform that action at this time.
0 commit comments