R
- the return value that the breaker returns (if breaker wants to return any value)public interface ContextAwareCircuitBreaker<R>
ExecutionContext
.
This means that implementing classes are required to pass given ExecutionContext
to both
break strategy and break handler since they should run with the given context and not
with the new (or other) context.
Modifier and Type | Method and Description |
---|---|
R |
executeInContext(Task<R> task,
BreakStrategy<R> breakStrategy,
BreakHandler<R> breakHandler,
ExecutionContext<R> executionContext)
Executes given task within given execution context.
|
R executeInContext(Task<R> task, BreakStrategy<R> breakStrategy, BreakHandler<R> breakHandler, ExecutionContext<R> executionContext) throws TaskExecutionException, BreakHandlerException, CircuitBreakerException
ExecutionContext
for the whole run of the method. This especially mean that this executionContext needs to
be passed to given break strategy and break handler, so that both the strategy and handler are
working within given context.task
- encapsulate java target-method which should be executed by this circuit breakerbreakStrategy
- the strategy which should define whether task should be executed or break handler should
handle fallback situationbreakHandler
- handles fallback situationexecutionContext
- already existing context which should be used for execution and be passed to both
break strategy and break handlerTaskExecutionException
- in case the task was executed but resulted in exceptionBreakHandlerException
- in case break handler was executed but was not able to provide fallback valueCircuitBreakerException
- if unexpected problem occurred while processing the task within CircuitBreakerCopyright © 2017. All rights reserved.