T - value type that is copied across thread boundary.public interface ContextPropagator<T>
ThreadLocal across different thread boundaries.| Modifier and Type | Interface and Description |
|---|---|
static class |
ContextPropagator.EmptyContextPropagator<T>
A convenient implementation of empty
ContextPropagator |
| Modifier and Type | Method and Description |
|---|---|
java.util.function.Consumer<java.util.Optional<T>> |
clear()
CleanUp value before thread execution finish.
|
java.util.function.Consumer<java.util.Optional<T>> |
copy()
Copies value from the parent thread into new executing thread.
|
static <T> java.lang.Runnable |
decorateRunnable(ContextPropagator propagator,
java.lang.Runnable runnable)
Method decorates runnable to copy variables across thread boundary.
|
static <T> java.lang.Runnable |
decorateRunnable(java.util.List<? extends ContextPropagator> propagators,
java.lang.Runnable runnable)
Method decorates runnable to copy variables across thread boundary.
|
static <T> java.util.function.Supplier<T> |
decorateSupplier(ContextPropagator propagator,
java.util.function.Supplier<T> supplier)
Method decorates supplier to copy variables across thread boundary.
|
static <T> java.util.function.Supplier<T> |
decorateSupplier(java.util.List<? extends ContextPropagator> propagators,
java.util.function.Supplier<T> supplier)
Method decorates supplier to copy variables across thread boundary.
|
static <T> ContextPropagator<T> |
empty()
An empty context propagator.
|
java.util.function.Supplier<java.util.Optional<T>> |
retrieve()
Retrieves value from the currently executing thread.
|
java.util.function.Supplier<java.util.Optional<T>> retrieve()
java.util.function.Consumer<java.util.Optional<T>> copy()
retrieve() in the parent thread.java.util.function.Consumer<java.util.Optional<T>> clear()
retrieve() in the parent thread.static <T> java.util.function.Supplier<T> decorateSupplier(ContextPropagator propagator, java.util.function.Supplier<T> supplier)
T - the type of variable that cross thread boundarypropagator - the instance of ContextPropagatorsupplier - the supplier to be decoratedstatic <T> java.util.function.Supplier<T> decorateSupplier(java.util.List<? extends ContextPropagator> propagators, java.util.function.Supplier<T> supplier)
T - the type of variable that cross thread boundarypropagators - the instance of ContextPropagator should be non null.supplier - the supplier to be decoratedstatic <T> java.lang.Runnable decorateRunnable(java.util.List<? extends ContextPropagator> propagators, java.lang.Runnable runnable)
T - the type of variable that cross thread boundarypropagators - the instance of ContextPropagatorrunnable - the runnable to be decoratedstatic <T> java.lang.Runnable decorateRunnable(ContextPropagator propagator, java.lang.Runnable runnable)
T - the type of variable that cross thread boundarypropagator - the instance of ContextPropagatorrunnable - the runnable to be decoratedstatic <T> ContextPropagator<T> empty()
T - type.ContextPropagator