Class ScopedValueContext

java.lang.Object
org.jdrupes.builder.core.ScopedValueContext

public final class ScopedValueContext extends Object

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.

  • Method Details

    • add

      public static void add(ScopedValue<?>... values)
      Adds the value to the registry.
      Parameters:
      values - the values
    • snapshot

      Creates a new snapshot.
      Returns:
      the snapshot
    • submitTo

      public static <T> Future<T> submitTo(ExecutorService executor, Callable<T> task)
      Executes the task with the registered scoped values inherited from the current thread.
      Type Parameters:
      T - the generic type
      Parameters:
      executor - the executor
      task - the task
      Returns:
      the future