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
public class BulkheadExecutor<R> extends PolicyExecutor<R>
A PolicyExecutor that handles failures according to aBulkhead.
-
-
Field Summary
Fields Modifier and Type Field Description private BulkheadImpl<R>bulkheadprivate java.time.DurationmaxWaitTime
-
Constructor Summary
Constructors Constructor Description BulkheadExecutor(BulkheadImpl<R> bulkhead, int policyIndex)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ExecutionResult<R>onFailure(ExecutionContext<R> context, ExecutionResult<R> result)Performs post-execution handling for aresultthat is considered a failure according toPolicyExecutor.isFailure(ExecutionResult), possibly creating a new result, else returning the originalresult.voidonSuccess(ExecutionResult<R> result)Performs post-execution handling for aresultthat is considered a success according toPolicyExecutor.isFailure(ExecutionResult).protected ExecutionResult<R>preExecute()Called before execution to return an alternative result or exception such as if execution is not allowed or needed.protected java.util.concurrent.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 Detail
-
bulkhead
private final BulkheadImpl<R> bulkhead
-
maxWaitTime
private final java.time.Duration maxWaitTime
-
-
Constructor Detail
-
BulkheadExecutor
public BulkheadExecutor(BulkheadImpl<R> bulkhead, int policyIndex)
-
-
Method Detail
-
preExecute
protected ExecutionResult<R> preExecute()
Description copied from class:PolicyExecutorCalled before execution to return an alternative result or exception such as if execution is not allowed or needed.- Overrides:
preExecutein classPolicyExecutor<R>
-
preExecuteAsync
protected java.util.concurrent.CompletableFuture<ExecutionResult<R>> preExecuteAsync(Scheduler scheduler, FailsafeFuture<R> future)
Description copied from class:PolicyExecutorCalled before an async execution to return an alternative result or exception such as if execution is not allowed or needed. Returnsnullif 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:
preExecuteAsyncin classPolicyExecutor<R>
-
onSuccess
public void onSuccess(ExecutionResult<R> result)
Description copied from class:PolicyExecutorPerforms post-execution handling for aresultthat is considered a success according toPolicyExecutor.isFailure(ExecutionResult).- Overrides:
onSuccessin classPolicyExecutor<R>
-
onFailure
protected ExecutionResult<R> onFailure(ExecutionContext<R> context, ExecutionResult<R> result)
Description copied from class:PolicyExecutorPerforms post-execution handling for aresultthat is considered a failure according toPolicyExecutor.isFailure(ExecutionResult), possibly creating a new result, else returning the originalresult.- Overrides:
onFailurein classPolicyExecutor<R>
-
-