|
14 | 14 | * limitations under the License. |
15 | 15 | */ |
16 | 16 | /** |
17 | | - * API concepts used throughout the {@code context-propagation} library. |
| 17 | + * The API of the {@code context-propagation} library. |
| 18 | + * |
| 19 | + * <h2>{@linkplain nl.talsmasoftware.context.api.ContextSnapshot}</h2> |
| 20 | + * <p> |
| 21 | + * Captures active values from all detected {@linkplain nl.talsmasoftware.context.api.ContextManager} implementations. |
| 22 | + * |
| 23 | + * <p> |
| 24 | + * The captured values in a snapshot can be reactivated in another thread.<br> |
| 25 | + * Snapshot reactivations must be closed again to avoid leaking context. |
18 | 26 | * |
19 | | - * <h2>{@linkplain nl.talsmasoftware.context.api.Context}</h2> |
20 | 27 | * <p> |
21 | | - * A {@linkplain nl.talsmasoftware.context.api.Context context} contains a value.<br> |
22 | | - * There can be one active context per thread. A context remains active until it is closed or another context |
23 | | - * is activated in the same thread. Normally, a context is backed by a {@linkplain java.lang.ThreadLocal ThreadLocal} |
24 | | - * variable. |
| 28 | + * All context aware utility classes in this library are tested |
| 29 | + * to make sure they reactivate and close snapshots in a safe way. |
25 | 30 | * |
26 | 31 | * <h2>{@linkplain nl.talsmasoftware.context.api.ContextManager}</h2> |
27 | 32 | * <p> |
28 | | - * Manages the active context. |
29 | | - * Can {@linkplain nl.talsmasoftware.context.api.ContextManager#activate(java.lang.Object) activate a new context} |
30 | | - * and provides access to |
31 | | - * the {@linkplain nl.talsmasoftware.context.api.ContextManager#getActiveContextValue() active context value}. |
| 33 | + * Manages {@linkplain nl.talsmasoftware.context.api.Context contexts} by providing a standard way of interacting |
| 34 | + * with {@linkplain java.lang.ThreadLocal} values. |
32 | 35 | * |
33 | 36 | * <p> |
34 | | - * For normal application code it should not be necessary to interact with context managers directly. |
35 | | - * Instead, using the various context-aware utility classes from the core module will automatically propagate |
36 | | - * any supported context types to background threads for you. |
| 37 | + * Managed context values can be accessed via a ContextManager by: |
| 38 | + * <ul> |
| 39 | + * <li>Calling {@code getActiveContextValue()} which <em>gets</em> the current thread-local value. |
| 40 | + * <li>Calling {@code activate(value)} which <em>sets</em> the given value until {@code close()} |
| 41 | + * is called on the returned {@code Context}. |
| 42 | + * <li>Calling {@code clear()} which <em>removes</em> the thread-local value. |
| 43 | + * </ul> |
37 | 44 | * |
38 | | - * <h2>{@linkplain nl.talsmasoftware.context.api.ContextSnapshot}</h2> |
| 45 | + * <h2>{@linkplain nl.talsmasoftware.context.api.Context}</h2> |
39 | 46 | * <p> |
40 | | - * A snapshot contains the active context value from all known context managers.<br> |
41 | | - * These values can be reactivated all together in another thread |
42 | | - * by {@linkplain nl.talsmasoftware.context.api.ContextSnapshot#reactivate() reactivating} the snapshot.<br> |
43 | | - * Reactivated snapshots <strong>must</strong> be closed to avoid leaking context. |
| 47 | + * Abstraction for an activated {@linkplain java.lang.ThreadLocal} value. |
44 | 48 | * |
45 | 49 | * <p> |
46 | | - * All context aware utility classes in this the core module of this library are tested |
47 | | - * to make sure they reactivate and close snapshots in a safe way. |
| 50 | + * When the context manager {@code activates} a value, a new Context is returned. |
| 51 | + * Closing this context will remove the activated value again. |
48 | 52 | * |
49 | 53 | * @author Sjoerd Talsma |
50 | 54 | */ |
|
0 commit comments