Package org.openrewrite
Interface ExecutionContext
- All Known Implementing Classes:
DelegatingExecutionContext
,HttpSenderExecutionContextView
,InMemoryExecutionContext
,ParsingExecutionContextView
,WatchableExecutionContext
public interface ExecutionContext
Passes messages between individual visitors or parsing operations and allows errors to be propagated
back to the process controlling parsing or recipe execution.
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptiondefault ExecutionContext
addObserver
(TreeObserver.Subscription observer) default <V,
T> T computeMessage
(String key, V value, T defaultValue, BiFunction<V, ? super T, ? extends T> remappingFunction) default Recipe
<T> T
getMessage
(String key) default <T> T
getMessage
(String key, T defaultValue) default Set<TreeObserver.Subscription>
default Duration
getRunTimeout
(int inputs) <T> T
pollMessage
(String key) default <T> T
pollMessage
(String key, T defaultValue) default void
putCurrentRecipe
(Recipe recipe) void
putMessage
(String key, Object value) default <V,
C extends Collection<V>>
CputMessageInCollection
(String key, V value, Supplier<C> newCollection) default <T> Set<T>
putMessageInSet
(String key, T value)
-
Field Details
-
CURRENT_RECIPE
- See Also:
-
-
Method Details
-
addObserver
@Incubating(since="7.20.0") default ExecutionContext addObserver(TreeObserver.Subscription observer) -
getObservers
-
putMessage
-
getMessage
-
computeMessage
default <V,T> T computeMessage(String key, V value, T defaultValue, BiFunction<V, ? super T, ? extends T> remappingFunction) -
putMessageInCollection
default <V,C extends Collection<V>> C putMessageInCollection(String key, V value, Supplier<C> newCollection) -
putMessageInSet
-
getMessage
-
pollMessage
-
pollMessage
-
putCurrentRecipe
-
getCurrentRecipe
-
getOnError
-
getOnTimeout
BiConsumer<Throwable,ExecutionContext> getOnTimeout() -
getRunTimeout
- Parameters:
inputs
- The number of inputs to the run. Allows the duration to be scaled to the number of inputs.- Returns:
- The maximum duration a run (e.g. parse operation, recipe run) can take.
-