Uses of Class
io.github.teceli.resiliencia.patterns.circuitbreaker.CircuitBreaker
Packages that use CircuitBreaker
-
Uses of CircuitBreaker in io.github.teceli.resiliencia.patterns.circuitbreaker
Methods in io.github.teceli.resiliencia.patterns.circuitbreaker that return CircuitBreakerModifier and TypeMethodDescriptionstatic <T> CircuitBreaker<T> ACircuitBreakeridentified byname, starting Closed with the default thresholds and window size.Use a customClockinstead of the system clock, e.g. a manual/virtual clock in tests to make wait-duration and half-open transition assertions deterministic and instant.CircuitBreaker.withFailureRateThreshold(double failureRateThreshold) Fraction of recorded calls that must fail, once the sliding window is full, to open the circuit.CircuitBreaker.withIgnoreOn(List<Class<? extends Throwable>> ignoreOn) Exception types that are never recorded as failures, even if also matched bywithRecordOn(java.util.List<java.lang.Class<? extends java.lang.Throwable>>).CircuitBreaker.withListener(ResilienceEvent.Listener listener) Add a listener notified of everyCircuitBreakerEventemitted by this instance.CircuitBreaker.withPermittedCallsInHalfOpenState(int permittedCallsInHalfOpenState) Number of test calls allowed through while HalfOpen.CircuitBreaker.withRecordOn(List<Class<? extends Throwable>> recordOn) Exception types that count as failures.CircuitBreaker.withRecordOnResult(Predicate<T> recordOnResult) Predicate evaluated against a successful return value to record it as a failure anyway, even though no exception was thrown — e.g. an HTTP client returning a 200 with an error body.CircuitBreaker.withSlidingWindowSize(int slidingWindowSize) Number of most recent calls used to compute the failure and slow-call rates.CircuitBreaker.withSlowCallDurationThreshold(Duration slowCallDurationThreshold) What counts as a slow call.CircuitBreaker.withSlowCallRateThreshold(double slowCallRateThreshold) Fraction of recorded calls that must exceedwithSlowCallDurationThreshold(java.time.Duration), once the sliding window is full, to open the circuit.CircuitBreaker.withWaitDurationInOpenState(Duration waitDurationInOpenState) How long the circuit stays Open before moving to HalfOpen to try test calls again.