Package dev.failsafe.internal
Class BulkheadExecutor<R>
java.lang.Object
dev.failsafe.spi.PolicyExecutor<R>
dev.failsafe.internal.BulkheadExecutor<R>
- Type Parameters:
R
- result type
A PolicyExecutor that handles failures according to a
Bulkhead
.-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ExecutionResult
<R> 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
.void
onSuccess
(ExecutionResult<R> result) Performs post-execution handling for aresult
that is considered a success according toPolicyExecutor.isFailure(ExecutionResult)
.protected ExecutionResult
<R> Called before execution to return an alternative result or exception such as if execution is not allowed or needed.protected CompletableFuture
<ExecutionResult<R>> 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 inherited from class dev.failsafe.spi.PolicyExecutor
apply, applyAsync, getPolicyIndex, isFailure, onFailureAsync, postExecute, postExecuteAsync
-
Field Details
-
bulkhead
-
maxWaitTime
-
-
Constructor Details
-
BulkheadExecutor
-
-
Method Details
-
preExecute
Description copied from class:PolicyExecutor
Called before execution to return an alternative result or exception such as if execution is not allowed or needed.- Overrides:
preExecute
in classPolicyExecutor<R>
-
preExecuteAsync
protected CompletableFuture<ExecutionResult<R>> preExecuteAsync(Scheduler scheduler, FailsafeFuture<R> future) Description copied from class:PolicyExecutor
Called before an async execution to return an alternative result or exception such as if execution is not allowed or needed. Returnsnull
if pre execution is not performed. If the resulting future is completed with anon-result
, then execution and post-execution should still be performed. If the resulting future is completed withnull
, then the execution is assumed to have been cancelled.- Overrides:
preExecuteAsync
in classPolicyExecutor<R>
-
onSuccess
Description copied from class:PolicyExecutor
Performs post-execution handling for aresult
that is considered a success according toPolicyExecutor.isFailure(ExecutionResult)
.- Overrides:
onSuccess
in classPolicyExecutor<R>
-
onFailure
Description copied from class:PolicyExecutor
Performs post-execution handling for aresult
that is considered a failure according toPolicyExecutor.isFailure(ExecutionResult)
, possibly creating a new result, else returning the originalresult
.- Overrides:
onFailure
in classPolicyExecutor<R>
-