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 of the {@link ContextAttribute} to its corresponding value. Context provides an ability
22+ * to be attached to the thread, which makes {@link ContextAttribute} values accessible via {@link ContextAttribute#get()}
23+ * method called from the same thread.
24+ *
25+ * @see ContextAttribute
26+ * @see ContextSnapshot
27+ */
2128public final class Context {
2229 /**
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.
30+ * Creates a new Context with a single mapping of the specified {@link AttributeValueHolder} to its value.
31+ * The returned {@link AttributeValueHolder} represents the last added to the Context mapping and can be used to
32+ * accumulate more mappings of {@link ContextAttribute}s to their values.
2533 *
2634 * @see AttributeValueHolder#with(ContextAttribute, Object)
2735 */
@@ -54,7 +62,12 @@ private <T> AttributeValueHolder(ContextAttribute<T> attr, T val, AttributeValue
5462 this .val = val ;
5563 }
5664
57- /** Adds a new mapping of the specified attribute to its value to the current {@link ContextDataChain}. */
65+ /**
66+ * Adds to the Context a new mapping of the specified attribute to its value.
67+ *
68+ * @return {@link AttributeValueHolder} instance that represents the last added to the Context mapping and can be
69+ * used to accumulate more mappings of {@link ContextAttribute}s to their values.
70+ */
5871 public <T > AttributeValueHolder with (ContextAttribute <T > attr , T val ) {
5972 return attr .get () == val ? this : new AttributeValueHolder (attr , val , this );
6073 }
@@ -79,9 +92,9 @@ <T> T value() {
7992 }
8093
8194 /**
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.
95+ * Attaches {@link ContextAttribute} values stored in current Context to the thread this method is called from.
96+ * If {@link ContextAttribute} value was already attached for the current thread, its value will be stashed and
97+ * replaced by the new ones.
8598 *
8699 * @return {@link Scope} instance that, when closed, resets the values for all {@link ContextAttribute}s added
87100 * to the current Context and restores them to the previously attached values, if any.
0 commit comments