1717
1818package org .apache .ignite .internal .thread .context ;
1919
20- /** Represents mapping of {@link ContextAttribute} to their corresponding values with the ability to be attached to the thread. */
20+ /**
21+ * Represents a set of mappings from the {@link ContextAttribute} to its corresponding value. The Context can be attached
22+ * to a thread, making the {@link ContextAttribute} values accessible through the {@link ContextAttribute#get()}
23+ * method when invoked from the same thread.
24+ *
25+ * @see ContextAttribute
26+ * @see ContextSnapshot
27+ * @see AttributeValueHolder#attach()
28+ */
2129public final class Context {
2230 /**
23- * Creates a new {@link AttributeValueHolder} with a single mapping of the specified {@link AttributeValueHolder}
24- * to the specified value. The {@link AttributeValueHolder} can be used to accumulate mappings.
31+ * Creates a new Context containing a single mapping from the specified {@link AttributeValueHolder} to its value.
32+ * The returned {@link AttributeValueHolder} represents the added mapping and can be used to accumulate to Context
33+ * more mappings form {@link ContextAttribute} to its value.
2534 *
2635 * @see AttributeValueHolder#with(ContextAttribute, Object)
2736 */
@@ -30,7 +39,7 @@ public static <T> AttributeValueHolder with(ContextAttribute<T> attr, T val) {
3039 }
3140
3241 /** */
33- public static final class AttributeValueHolder extends ContextDataChain <AttributeValueHolder > {
42+ public static final class AttributeValueHolder extends ContextDataChainNode <AttributeValueHolder > {
3443 /** */
3544 private static final AttributeValueHolder ROOT = new AttributeValueHolder ();
3645
@@ -54,7 +63,13 @@ private <T> AttributeValueHolder(ContextAttribute<T> attr, T val, AttributeValue
5463 this .val = val ;
5564 }
5665
57- /** Adds a new mapping of the specified attribute to its value to the current {@link ContextDataChain}. */
66+ /**
67+ * Expands Context by adding new mapping from the specified {@link ContextAttribute} to its value.
68+ * After this operation, the Context contains all previously added mappings plus the new one.
69+ *
70+ * @return {@link AttributeValueHolder} instance that represents the added mapping and can be used to accumulate
71+ * more mappings from {@link ContextAttribute} to its values.
72+ */
5873 public <T > AttributeValueHolder with (ContextAttribute <T > attr , T val ) {
5974 return attr .get () == val ? this : new AttributeValueHolder (attr , val , this );
6075 }
@@ -79,9 +94,9 @@ <T> T value() {
7994 }
8095
8196 /**
82- * Attaches {@link ContextAttribute} values stored in current {@link ContextDataChain} to the thread
83- * this method is called from . If {@link ContextAttribute} value was already attached for the current thread,
84- * its value will be stashed and replaced by the new ones .
97+ * Attaches {@link ContextAttribute} values stored in current Context to the thread from which this method is
98+ * called. If {@link ContextAttribute} value was already attached for the current thread, its value will be
99+ * stashed and replaced by the new one .
85100 *
86101 * @return {@link Scope} instance that, when closed, resets the values for all {@link ContextAttribute}s added
87102 * to the current Context and restores them to the previously attached values, if any.
0 commit comments