Uses of Class
dev.failsafe.spi.ExecutionResult
Packages that use ExecutionResult
Package
Description
APIs for performing failsafe executions.
The Failsafe Service Provider Interface (SPI).
-
Uses of ExecutionResult in dev.failsafe
Fields in dev.failsafe declared as ExecutionResultModifier and TypeFieldDescriptionprivate final ExecutionResult
<R> ExecutionImpl.previousResult
(package private) ExecutionResult
<R> ExecutionImpl.result
Fields in dev.failsafe with type parameters of type ExecutionResultModifier and TypeFieldDescription(package private) final BiConsumer
<ExecutionResult<R>, ExecutionContext<R>> FailsafeExecutor.completionHandler
private Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> AsyncExecutionImpl.outerFn
private Function
<SyncExecutionInternal<R>, ExecutionResult<R>> SyncExecutionImpl.outerFn
Methods in dev.failsafe that return ExecutionResultModifier and TypeMethodDescriptionExecutionImpl.getResult()
(package private) ExecutionResult
<R> ExecutionImpl.postExecute
(ExecutionResult<R> result) Externally called.(package private) ExecutionResult
<R> SyncExecutionImpl.postExecute
(ExecutionResult<R> result) Methods in dev.failsafe that return types with arguments of type ExecutionResultModifier and TypeMethodDescription(package private) static <R> Function
<SyncExecutionImpl<R>, ExecutionResult<R>> Functions.get
(ContextualSupplier<R, R> supplier, Executor executor) Returns a Supplier for synchronous executions that pre-executes theexecution
, applies thesupplier
, records the result and returns the result.(package private) static <R> Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> Functions.getPromise
(ContextualSupplier<R, R> supplier, Executor executor) Returns a Function for asynchronous executions that pre-executes theexecution
, applies thesupplier
, records the result and returns a promise containing the result.(package private) static <R> Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> Functions.getPromiseExecution
(AsyncRunnable<R> runnable, Executor executor) Returns a Function for asynchronous executions that pre-executes theexecution
, runs therunnable
, and attempts to complete theexecution
if a failure occurs.(package private) static <R> Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> Functions.getPromiseOfStage
(ContextualSupplier<R, ? extends CompletionStage<? extends R>> supplier, FailsafeFuture<R> future, Executor executor) Returns a Function that for asynchronous executions that pre-executes theexecution
, applies thesupplier
, records the result and returns a promise containing the result.(package private) static <R> Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> Functions.toAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Returns a Function that asynchronously applies theinnerFn
on the first call, synchronously on subsequent calls, and returns a promise containing the result.(package private) static <R> Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> Functions.toExecutionAware
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn) Returns a Function that returns an execution result if one was previously recorded, else applies theinnerFn
.Methods in dev.failsafe with parameters of type ExecutionResultModifier and TypeMethodDescriptionprivate void
AsyncExecutionImpl.complete
(ExecutionResult<R> result, Throwable error) (package private) ExecutionResult
<R> ExecutionImpl.postExecute
(ExecutionResult<R> result) Externally called.(package private) ExecutionResult
<R> SyncExecutionImpl.postExecute
(ExecutionResult<R> result) void
ExecutionImpl.record
(ExecutionResult<R> result) Method parameters in dev.failsafe with type arguments of type ExecutionResultModifier and TypeMethodDescriptionprivate <T> CompletableFuture
<T> FailsafeExecutor.callAsync
(Function<FailsafeFuture<T>, Function<AsyncExecutionInternal<T>, CompletableFuture<ExecutionResult<T>>>> innerFn, boolean asyncExecution) Calls the asynchronousinnerFn
via the configured Scheduler, handling results according to the configured policies.(package private) static <R> Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> Functions.toAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Returns a Function that asynchronously applies theinnerFn
on the first call, synchronously on subsequent calls, and returns a promise containing the result.(package private) static <R> Function
<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> Functions.toExecutionAware
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn) Returns a Function that returns an execution result if one was previously recorded, else applies theinnerFn
.Constructors in dev.failsafe with parameters of type ExecutionResultModifierConstructorDescription(package private)
ExecutionImpl
(ExecutionResult<R> previousResult) Used for testing purposes onlyConstructor parameters in dev.failsafe with type arguments of type ExecutionResultModifierConstructorDescription(package private)
AsyncExecutionImpl
(List<Policy<R>> policies, Scheduler scheduler, FailsafeFuture<R> future, boolean asyncExecution, Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn) (package private)
SyncExecutionImpl
(FailsafeExecutor<R> executor, Scheduler scheduler, CallImpl<R> call, Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn) Create a sync execution for theexecutor
. -
Uses of ExecutionResult in dev.failsafe.internal
Methods in dev.failsafe.internal that return ExecutionResultModifier and TypeMethodDescriptionprotected ExecutionResult
<R> BulkheadExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) protected ExecutionResult
<R> CircuitBreakerExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) RetryPolicyExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) protected ExecutionResult
<R> BulkheadExecutor.preExecute()
protected ExecutionResult
<R> CircuitBreakerExecutor.preExecute()
protected ExecutionResult
<R> RateLimiterExecutor.preExecute()
Methods in dev.failsafe.internal that return types with arguments of type ExecutionResultModifier and TypeMethodDescriptionFallbackExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Performs an execution by calling pre-execute else calling the supplier, applying a fallback if it fails, and calling post-execute.RetryPolicyExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) TimeoutExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Schedules a separate timeout call that fails withTimeoutExceededException
if the policy's timeout is exceeded.FallbackExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Performs an async execution by calling pre-execute else calling the supplier and doing a post-execute.RetryPolicyExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) TimeoutExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Schedules a separate timeout call that blocks and fails withTimeoutExceededException
if the policy's timeout is exceeded.RetryPolicyExecutor.onFailureAsync
(ExecutionContext<R> context, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Defaults async executions to not be complete untilsays they are
.protected CompletableFuture
<ExecutionResult<R>> BulkheadExecutor.preExecuteAsync
(Scheduler scheduler, FailsafeFuture<R> future) protected CompletableFuture
<ExecutionResult<R>> RateLimiterExecutor.preExecuteAsync
(Scheduler scheduler, FailsafeFuture<R> future) Methods in dev.failsafe.internal with parameters of type ExecutionResultModifier and TypeMethodDescriptionvoid
EventHandler.handle
(ExecutionResult<R> result, ExecutionContext<R> context) boolean
TimeoutExecutor.isFailure
(ExecutionResult<R> result) (package private) boolean
RetryPolicyExecutor.isValidResult
(ExecutionResult<R> result, Throwable error, CompletableFuture<ExecutionResult<R>> promise) Completes thepromise
and returnsfalse
if theresult
orerror
are invalid, else returnstrue
.protected ExecutionResult
<R> BulkheadExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) protected ExecutionResult
<R> CircuitBreakerExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) RetryPolicyExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) RetryPolicyExecutor.onFailureAsync
(ExecutionContext<R> context, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Defaults async executions to not be complete untilsays they are
.void
BulkheadExecutor.onSuccess
(ExecutionResult<R> result) void
CircuitBreakerExecutor.onSuccess
(ExecutionResult<R> result) Method parameters in dev.failsafe.internal with type arguments of type ExecutionResultModifier and TypeMethodDescriptionFallbackExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Performs an execution by calling pre-execute else calling the supplier, applying a fallback if it fails, and calling post-execute.RetryPolicyExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) TimeoutExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Schedules a separate timeout call that fails withTimeoutExceededException
if the policy's timeout is exceeded.FallbackExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Performs an async execution by calling pre-execute else calling the supplier and doing a post-execute.RetryPolicyExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) TimeoutExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Schedules a separate timeout call that blocks and fails withTimeoutExceededException
if the policy's timeout is exceeded.RetryPolicyExecutor.handleAsync
(AsyncExecutionInternal<R> execution, Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future, CompletableFuture<ExecutionResult<R>> promise, AtomicReference<ExecutionResult<R>> previousResultRef) RetryPolicyExecutor.handleAsync
(AsyncExecutionInternal<R> execution, Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future, CompletableFuture<ExecutionResult<R>> promise, AtomicReference<ExecutionResult<R>> previousResultRef) RetryPolicyExecutor.handleAsync
(AsyncExecutionInternal<R> execution, Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future, CompletableFuture<ExecutionResult<R>> promise, AtomicReference<ExecutionResult<R>> previousResultRef) (package private) boolean
RetryPolicyExecutor.isValidResult
(ExecutionResult<R> result, Throwable error, CompletableFuture<ExecutionResult<R>> promise) Completes thepromise
and returnsfalse
if theresult
orerror
are invalid, else returnstrue
. -
Uses of ExecutionResult in dev.failsafe.spi
Fields in dev.failsafe.spi declared as ExecutionResultFields in dev.failsafe.spi with type parameters of type ExecutionResultModifier and TypeFieldDescriptionprivate Map
<Integer, BiConsumer<Boolean, ExecutionResult<R>>> FailsafeFuture.cancelFunctions
private final BiConsumer
<ExecutionResult<R>, ExecutionContext<R>> FailsafeFuture.completionHandler
Methods in dev.failsafe.spi that return ExecutionResultModifier and TypeMethodDescriptionstatic <R> ExecutionResult
<R> Returns an ExecutionResult with theexception
set,complete
true andsuccess
false.ExecutionInternal.getResult()
Returns the recorded result for an execution attempt.static <R> ExecutionResult
<R> ExecutionResult.none()
Returns an execution that was completed with a non-result.protected ExecutionResult
<R> PolicyExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) Performs post-execution handling for aresult
that is considered a failure according toPolicyExecutor.isFailure(ExecutionResult)
, possibly creating a new result, else returning the originalresult
.PolicyExecutor.postExecute
(ExecutionInternal<R> execution, ExecutionResult<R> result) Performs synchronous post-execution handling for aresult
.protected ExecutionResult
<R> PolicyExecutor.preExecute()
Called before execution to return an alternative result or exception such as if execution is not allowed or needed.static <R> ExecutionResult
<R> ExecutionResult.success
(R result) Returns an ExecutionResult with theresult
set,complete
true andsuccess
true.ExecutionResult.with
(long delayNanos, boolean complete, boolean success) Returns a copy of the ExecutionResult with thedelayNanos
,complete
andsuccess
values.ExecutionResult.withDelay
(long delayNanos) Returns a copy of the ExecutionResult with thedelayNanos
value.ExecutionResult.withException()
Returns a copy of the ExecutionResult with success value of {code false}.ExecutionResult.withNonResult()
Returns a copy of the ExecutionResult with a non-result, and complete and success set to true.ExecutionResult.withNotComplete()
Returns a copy of the ExecutionResult withcomplete
set to false, else this if nothing has changed.ExecutionResult.withResult
(R result) Returns a copy of the ExecutionResult with theresult
value, and complete and success set to true.ExecutionResult.withSuccess()
Returns a copy of the ExecutionResult with thecomplete
andsuccess
values oftrue
.Methods in dev.failsafe.spi that return types with arguments of type ExecutionResultModifier and TypeMethodDescriptionPolicyExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Performs an execution by calling pre-execute else calling the supplier and doing a post-execute.PolicyExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Performs an async execution by calling pre-execute else calling the supplier and doing a post-execute.static <R> CompletableFuture
<ExecutionResult<R>> ExecutionResult.nullFuture()
Returns a CompletableFuture that is completed withnull
.protected CompletableFuture
<ExecutionResult<R>> PolicyExecutor.onFailureAsync
(ExecutionContext<R> context, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Performs potentially asynchrononus post-execution handling for a failedresult
, possibly creating a new result, else returning the originalresult
.protected CompletableFuture
<ExecutionResult<R>> PolicyExecutor.postExecuteAsync
(AsyncExecutionInternal<R> execution, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Performs potentially asynchronous post-execution handling for aresult
.protected CompletableFuture
<ExecutionResult<R>> PolicyExecutor.preExecuteAsync
(Scheduler scheduler, FailsafeFuture<R> future) Called before an async execution to return an alternative result or exception such as if execution is not allowed or needed.Methods in dev.failsafe.spi with parameters of type ExecutionResultModifier and TypeMethodDescriptionvoid
FailsafeFuture.cancelDependencies
(PolicyExecutor<R> cancellingPolicyExecutor, boolean mayInterrupt, ExecutionResult<R> cancelResult) Applies anycancel functions
with thecancelResult
for PolicyExecutors whose policyIndex is invalid input: '<' the policyIndex of thecancellingPolicyExecutor
.boolean
FailsafeFuture.completeResult
(ExecutionResult<R> result) Completes the execution with theresult
and calls the completion handler.private void
PolicyExecutor.handleFailure
(ExecutionResult<R> result, ExecutionContext<R> context) private void
PolicyExecutor.handleSuccess
(ExecutionResult<R> result, ExecutionContext<R> context) protected boolean
PolicyExecutor.isFailure
(ExecutionResult<R> result) Returns whether theresult
is a success according to the policy.protected ExecutionResult
<R> PolicyExecutor.onFailure
(ExecutionContext<R> context, ExecutionResult<R> result) Performs post-execution handling for aresult
that is considered a failure according toPolicyExecutor.isFailure(ExecutionResult)
, possibly creating a new result, else returning the originalresult
.protected CompletableFuture
<ExecutionResult<R>> PolicyExecutor.onFailureAsync
(ExecutionContext<R> context, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Performs potentially asynchrononus post-execution handling for a failedresult
, possibly creating a new result, else returning the originalresult
.protected void
PolicyExecutor.onSuccess
(ExecutionResult<R> result) Performs post-execution handling for aresult
that is considered a success according toPolicyExecutor.isFailure(ExecutionResult)
.PolicyExecutor.postExecute
(ExecutionInternal<R> execution, ExecutionResult<R> result) Performs synchronous post-execution handling for aresult
.protected CompletableFuture
<ExecutionResult<R>> PolicyExecutor.postExecuteAsync
(AsyncExecutionInternal<R> execution, ExecutionResult<R> result, Scheduler scheduler, FailsafeFuture<R> future) Performs potentially asynchronous post-execution handling for aresult
.void
ExecutionInternal.record
(ExecutionResult<R> result) Records theresult
if the execution has beenpre-executed
and a result has not already been recorded.Method parameters in dev.failsafe.spi with type arguments of type ExecutionResultModifier and TypeMethodDescriptionPolicyExecutor.apply
(Function<SyncExecutionInternal<R>, ExecutionResult<R>> innerFn, Scheduler scheduler) Performs an execution by calling pre-execute else calling the supplier and doing a post-execute.PolicyExecutor.applyAsync
(Function<AsyncExecutionInternal<R>, CompletableFuture<ExecutionResult<R>>> innerFn, Scheduler scheduler, FailsafeFuture<R> future) Performs an async execution by calling pre-execute else calling the supplier and doing a post-execute.void
FailsafeFuture.setCancelFn
(int policyIndex, BiConsumer<Boolean, ExecutionResult<R>> cancelFn) Sets acancelFn
to be called when a PolicyExecutorcancels dependencies
with a policyIndex > the givenpolicyIndex
, or when this future iscancelled
.void
FailsafeFuture.setCancelFn
(PolicyExecutor<R> policyExecutor, BiConsumer<Boolean, ExecutionResult<R>> cancelFn) Sets acancelFn
to be called when a PolicyExecutorcancels dependencies
with a policyIndex > the policyIndex of the givenpolicyExecutor
, or when this future iscancelled
.Constructor parameters in dev.failsafe.spi with type arguments of type ExecutionResultModifierConstructorDescriptionFailsafeFuture
(BiConsumer<ExecutionResult<R>, ExecutionContext<R>> completionHandler)