Package org.apache.groovy.runtime.async
Class ScopedLocal.Carrier
java.lang.Object
org.apache.groovy.runtime.async.ScopedLocal.Carrier
- Enclosing class:
- ScopedLocal<T>
An immutable set of scoped-local bindings that can be applied
atomically for the duration of a
Runnable or Supplier.- Since:
- 6.0.0
-
Method Summary
Modifier and TypeMethodDescription<R> RExecutes the supplier with all bindings in this carrier active and returns its result.voidExecutes the action with all bindings in this carrier active.where(ScopedLocal<T> key, T value) Adds another binding to this carrier, returning a new carrier that includes all previous bindings plus the new one.
-
Method Details
-
where
Adds another binding to this carrier, returning a new carrier that includes all previous bindings plus the new one.- Type Parameters:
T- the value type- Parameters:
key- the scoped-local to bindvalue- the value to bind; may benull- Returns:
- a new carrier with the additional binding
-
run
Executes the action with all bindings in this carrier active.- Parameters:
action- the action to execute
-
call
Executes the supplier with all bindings in this carrier active and returns its result.- Type Parameters:
R- the result type- Parameters:
supplier- the supplier to execute- Returns:
- the supplier's result
-