Class CircuitBreaker<V>
- java.lang.Object
-
- io.smallrye.faulttolerance.core.circuit.breaker.CircuitBreaker<V>
-
- All Implemented Interfaces:
FaultToleranceStrategy<V>
- Direct Known Subclasses:
CompletionStageCircuitBreaker
public class CircuitBreaker<V> extends Object implements FaultToleranceStrategy<V>
-
-
Field Summary
Fields Modifier and Type Field Description static intSTATE_CLOSEDstatic intSTATE_HALF_OPENstatic intSTATE_OPEN
-
Constructor Summary
Constructors Constructor Description CircuitBreaker(FaultToleranceStrategy<V> delegate, String description, ExceptionDecision exceptionDecision, long delayInMillis, int requestVolumeThreshold, double failureRatio, int successThreshold, Stopwatch stopwatch, Timer timer)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Vapply(InvocationContext<V> ctx)Apply the fault tolerance strategy around the targetCallable.intcurrentState()voidreset()
-
-
-
Field Detail
-
STATE_CLOSED
public static final int STATE_CLOSED
- See Also:
- Constant Field Values
-
STATE_OPEN
public static final int STATE_OPEN
- See Also:
- Constant Field Values
-
STATE_HALF_OPEN
public static final int STATE_HALF_OPEN
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CircuitBreaker
public CircuitBreaker(FaultToleranceStrategy<V> delegate, String description, ExceptionDecision exceptionDecision, long delayInMillis, int requestVolumeThreshold, double failureRatio, int successThreshold, Stopwatch stopwatch, Timer timer)
-
-
Method Detail
-
apply
public V apply(InvocationContext<V> ctx) throws Exception
Description copied from interface:FaultToleranceStrategyApply the fault tolerance strategy around the targetCallable. TheCallableis wrapped in anInvocationContext.- Specified by:
applyin interfaceFaultToleranceStrategy<V>- Parameters:
ctx- theInvocationContextwrapping theCallableguarded by this fault tolerance strategy- Returns:
- result computed by the target
Callable - Throws:
Exception- if result couldn't be computed
-
currentState
public int currentState()
-
reset
public void reset()
-
-