R
- the return type of actual methodpublic class ReturnStaticValueHandler<R> extends Object implements BreakHandler<R>
BreakHandler
that always returns the value given as a parameter.
This implementation can be shared between different executions of circuit breaker and therefore does not require
factory method implementing BreakHandlerFactory
to be reusable.
Constructor and Description |
---|
ReturnStaticValueHandler(R returnValue) |
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.
|
public ReturnStaticValueHandler(R returnValue)
public R onBreak(ContextAwareCircuitBreaker<R> circuitBreaker, Task<R> task, BreakStrategy<R> breakStrategy, ExecutionContext<R> executionContext)
BreakHandler
onBreak
in interface BreakHandler<R>
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)Copyright © 2017. All rights reserved.