R
- the return type of onBreak method. This must be the same return type as the of of executed Taskpublic interface BreakHandler<R>
It's main goal is to provide a fallback value for a method in case the CircuitBreaker decided not to execute the
real method. If providing a fallback
value is not possible break handler should throw BreakHandlerException
Modifier and Type | Method and Description |
---|---|
R |
onBreak(ContextAwareCircuitBreaker<R> circuitBreaker,
Task<R> task,
BreakStrategy<R> breakStrategy,
ExecutionContext<R> executionContext)
Handles situation when break occurs.
|
R onBreak(ContextAwareCircuitBreaker<R> circuitBreaker, Task<R> task, BreakStrategy<R> breakStrategy, ExecutionContext<R> executionContext) throws TaskExecutionException, CircuitBreakerException, BreakHandlerException
circuitBreaker
- a reference to the ContextAwareCircuitBreaker
which called this break handlertask
- the task which execution was prevented by break strategy and resulted in calling this
break handlerbreakStrategy
- the strategy which prevented the execution of task and resulted in calling this break
handlerexecutionContext
- contains current execution data (specific to current execution)TaskExecutionException
- in case there was exception while executing the task by this break handler (but
only in case this handler decided to execute the task - there is no possibility
to throw TaskExecutionException in case there was no attempt to execute a task)CircuitBreakerException
- in case the break handler tried to execute some task on circuitBreaker but the
circuitBreaker fallen with unexpected exceptionBreakHandlerException
- in case this break handler is not able to provide the the fallback valueCopyright © 2017. All rights reserved.