Class ThreadLocalContext.Snapshot
java.lang.Object
io.fluxzero.sdk.common.ThreadLocalContext.Snapshot
- Enclosing class:
ThreadLocalContext
A reusable snapshot of the context that was active when
ThreadLocalContext.capture() was called.-
Method Summary
Modifier and TypeMethodDescriptionbooleanisEmpty()Returns whether this snapshot contains no participating values.voidRuns a task with this snapshot active and restores the previous context afterwards.<T> TSupplies a value with this snapshot active and restores the previous context afterwards.Wraps a task so that this snapshot is active whenever the task runs.<T,U> BiConsumer <T, U> wrap(BiConsumer<T, U> task) Wraps a two-argument consumer, such as a completion callback, with this snapshot.<T,R> Function <T, R> Wraps a function so that this snapshot is active whenever the function runs.<T> Supplier<T> Wraps a supplier so that this snapshot is active whenever the supplier runs.
-
Method Details
-
isEmpty
public boolean isEmpty()Returns whether this snapshot contains no participating values. -
run
Runs a task with this snapshot active and restores the previous context afterwards. -
supply
Supplies a value with this snapshot active and restores the previous context afterwards. -
wrap
-
wrap
-
wrap
Wraps a two-argument consumer, such as a completion callback, with this snapshot. -
wrap
-