R
- the return value of java method (target-method) executed by this circuit breaker. For methods
which does not return value Void
should be used.public interface CircuitBreaker<R>
For details refer to comments on methods.
Modifier and Type | Method and Description |
---|---|
default R |
execute(Task<R> task,
BreakStrategy<R> breakStrategy,
BreakHandler<R> breakHandler)
Executes the given
Task only when given BreakStrategy allows the execution at the time of call. |
<U> R |
execute(Task<R> task,
BreakStrategy<R> breakStrategy,
BreakHandler<R> breakHandler,
U userData)
Executes the given
Task only when given BreakStrategy allows the execution at the time of call. |
default R execute(Task<R> task, BreakStrategy<R> breakStrategy, BreakHandler<R> breakHandler) throws TaskExecutionException, BreakHandlerException, CircuitBreakerException
Task
only when given BreakStrategy
allows the execution at the time of call.
If execution is not allowed BreakHandler
is used to handle this situation and return fallback value.task
- encapsulates java method to be executed - called target-method in this contextbreakStrategy
- decides whether to execute the task or prevent execution and executed breakHandler insteadbreakHandler
- handles the situation when the strategy does not allow method executionTaskExecutionException
- if execution of task resulted in exceptionBreakHandlerException
- if breakHandler (if executed) could not provide the fallback valueCircuitBreakerException
- if unexpected problem occurred while processing the task within CircuitBreaker<U> R execute(Task<R> task, BreakStrategy<R> breakStrategy, BreakHandler<R> breakHandler, U userData) throws TaskExecutionException, BreakHandlerException, CircuitBreakerException
Task
only when given BreakStrategy
allows the execution at the time of call.
If execution is not allowed BreakHandler
is used to handle this situation and return fallback value.
Allows to pass some custom data to the strategy which will be available via ExecutionContext.getUserData()
U
- the type of user data passed to execution contexttask
- encapsulates java method to be executed - called target-method in this contextbreakStrategy
- decides whether to execute the task or prevent execution and executed breakHandler insteadbreakHandler
- handles the situation when the strategy does not allow method executionuserData
- custom user data which will be available to strategies via
ExecutionContext.getUserData()
TaskExecutionException
- if execution of task resulted in exceptionBreakHandlerException
- if breakHandler (if executed) could not provide the fallbackvalueCircuitBreakerException
- if the method execution resulted in exception or breakHandler resulted in exceptionCopyright © 2017. All rights reserved.