Class ScopedValueContext
java.lang.Object
org.jdrupes.builder.core.ScopedValueContext
Supports using scoped values in another context.
Scoped values are bound in a thread context. However, their binding is no longer available when an action is executed in another thread or as a callback.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classA snapshot of the the values of the registered scoped value instances. -
Method Summary
Modifier and TypeMethodDescriptionstatic voidadd(ScopedValue<?>... values) Adds the value to the registry.static ScopedValueContext.Snapshotsnapshot()Creates a new snapshot.static <T> Future<T> submitTo(ExecutorService executor, Callable<T> task) Executes the task with the registered scoped values inherited from the current thread.
-
Method Details
-
add
Adds the value to the registry.- Parameters:
values- the values
-
snapshot
-
submitTo
Executes the task with the registered scoped values inherited from the current thread.- Type Parameters:
T- the generic type- Parameters:
executor- the executortask- the task- Returns:
- the future
-