Package io.micronaut.core.execution
Interface ImperativeExecutionFlow<T>
- Type Parameters:
T- The value type
- All Superinterfaces:
ExecutionFlow<T>
The imperative execution flow.
- Since:
- 4.0.0
- Author:
- Denis Stepnov
-
Method Summary
Modifier and TypeMethodDescriptiongetError()getValue()default @NonNull ExecutionFlow<T>timeout(@NonNull Duration timeout, @NonNull ScheduledExecutorService scheduler, @Nullable BiConsumer<T, Throwable> onDiscard) Deprecated.default @NonNull ImperativeExecutionFlow<T>Create anImperativeExecutionFlowfrom this execution flow, if possible.Methods inherited from interface io.micronaut.core.execution.ExecutionFlow
cancel, completeTo, flatMap, map, onComplete, onErrorResume, putInContext, putInContextIfAbsent, then, toCompletableFuture, tryCompleteError, tryCompleteValue
-
Method Details
-
getValue
- Returns:
- The value if present
-
getError
- Returns:
- The exception if present
-
getContext
- Returns:
- The context if present
-
tryComplete
Description copied from interface:ExecutionFlowCreate anImperativeExecutionFlowfrom this execution flow, if possible. The flow will have its result immediately available.- Specified by:
tryCompletein interfaceExecutionFlow<T>- Returns:
- The imperative flow, or
nullif this flow is not complete or does not support this operation
-
timeout
@NonNull @Deprecated default @NonNull ExecutionFlow<T> timeout(@NonNull @NonNull Duration timeout, @NonNull @NonNull ScheduledExecutorService scheduler, @Nullable @Nullable BiConsumer<T, Throwable> onDiscard) Deprecated.This method has no effect forImperativeExecutionFlow, it makes no sense to use itCreate a newExecutionFlowthat either returns the same result or, if the timeout expires before the result is received, aTimeoutException.- Specified by:
timeoutin interfaceExecutionFlow<T>- Parameters:
timeout- The timeoutscheduler- Scheduler to schedule the timeout taskonDiscard- An optional consumer to be called on the value of this flow if the flow completes after the timeout has expired and thus the value is discarded- Returns:
- A new flow that will produce either the same value or a
TimeoutException
-
ImperativeExecutionFlow, it makes no sense to use it