Package org.openrewrite
Interface ExecutionContext
- All Known Implementing Classes:
AIExecutionContextView,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 ExecutionContextaddObserver(TreeObserver.Subscription observer) default <V,T> T computeMessage(String key, V value, Supplier<T> defaultValue, BiFunction<V, ? super T, ? extends T> remappingFunction) <T> TgetMessage(String key) default <T> TgetMessage(String key, T defaultValue) default Set<TreeObserver.Subscription>The recipe that scheduled this recipe's execution viaRecipe.getApplicableTests()orRecipe.getSingleSourceApplicableTests().default DurationgetRunTimeout(int inputs) default int<T> TpollMessage(String key) default <T> TpollMessage(String key, T defaultValue) default voidputCurrentRecipe(Recipe recipe) voidputMessage(String key, @Nullable 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) putParentRecipe(@Nullable Recipe recipe)
-
Field Details
-
CURRENT_RECIPE
- See Also:
-
PARENT_RECIPE
- See Also:
-
UNCAUGHT_EXCEPTION_COUNT
- See Also:
-
DATA_TABLES
- 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, Supplier<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
-
putParentRecipe
@Nullable @Incubating(since="7.37.0") default @Nullable Recipe putParentRecipe(@Nullable @Nullable Recipe recipe) - Returns:
- The previous parent recipe.
-
getParentRecipe
The recipe that scheduled this recipe's execution viaRecipe.getApplicableTests()orRecipe.getSingleSourceApplicableTests(). -
incrementAndGetUncaughtExceptionCount
default int incrementAndGetUncaughtExceptionCount() -
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.
-