java.lang.Runnablepublic class RunnableWithContext extends WrapperWithContext<T> implements java.lang.Runnable
Runnable that reactivates a context snapshot before
calling a delegate.| Modifier and Type | Field | Description |
|---|---|---|
protected java.util.function.Consumer<ContextSnapshot> |
contextSnapshotConsumer |
The context snapshot consumer to provide a new snapshot to after the function is completed, may be
null. |
| Modifier | Constructor | Description |
|---|---|---|
protected |
RunnableWithContext(java.util.function.Supplier<ContextSnapshot> supplier,
java.lang.Runnable delegate,
java.util.function.Consumer<ContextSnapshot> consumer) |
|
|
RunnableWithContext(ContextSnapshot snapshot,
java.lang.Runnable delegate) |
Creates a new runnable that performs the following steps, in-order:
first reactivate the given snapshot
then run the delegate
|
|
RunnableWithContext(ContextSnapshot snapshot,
java.lang.Runnable delegate,
java.util.function.Consumer<ContextSnapshot> consumer) |
Creates a new runnable that performs the following steps, in-order:
first reactivate the given snapshot
then run the delegate
finally, if a consumer was provided
capture a new ContextSnapshot
|
| Modifier and Type | Method | Description |
|---|---|---|
protected java.util.Optional<java.util.function.Consumer<ContextSnapshot>> |
consumer() |
Deprecated.
The functional wrappers currently no longer use this method.
|
void |
run() |
clone, finalize, getClass, notify, notifyAll, wait, wait, waitdelegate, nonNullDelegateequals, hashCode, snapshot, toStringprotected final java.util.function.Consumer<ContextSnapshot> contextSnapshotConsumer
null.public RunnableWithContext(ContextSnapshot snapshot, java.lang.Runnable delegate)
snapshot - A snapshot for the contexts to run the delegate in.delegate - The delegate to run.RunnableWithContext(ContextSnapshot, Runnable, Consumer)public RunnableWithContext(ContextSnapshot snapshot, java.lang.Runnable delegate, java.util.function.Consumer<ContextSnapshot> consumer)
snapshot - A snapshot for the contexts to run the delegate in.delegate - The delegate to run.consumer - An optional consumer for the resulting contexts after the delegate ran (in case it changed)protected RunnableWithContext(java.util.function.Supplier<ContextSnapshot> supplier, java.lang.Runnable delegate, java.util.function.Consumer<ContextSnapshot> consumer)
public void run()
run in interface java.lang.Runnable@Deprecated protected java.util.Optional<java.util.function.Consumer<ContextSnapshot>> consumer()
Copyright © 2016–2019 Talsma ICT. All rights reserved.