Circuit breakers
On This Lesson 4 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
stop calling a failing dependency and probe for recovery.
Planned topics
- States: closed (calls pass), open (calls fail fast), half-open (a few trial calls).
- Open when failure rate or slow-call rate crosses a threshold in a sliding window.
- Failing fast frees threads and gives the dependency room to recover.
- Count only relevant failures (5xx, timeouts), not 4xx business errors.
- Test it: a breaker that was never opened in a test may be misconfigured.
Draft outline details
Demonstration
CircuitBreakerConfig cfg = CircuitBreakerConfig.custom()
.slidingWindowSize(20).failureRateThreshold(50)
.slowCallDurationThreshold(Duration.ofMillis(500)).slowCallRateThreshold(50)
.waitDurationInOpenState(Duration.ofSeconds(10))
.permittedNumberOfCallsInHalfOpenState(3).build();Check your understanding
What does an open breaker do with a new call?
Show answer
Rejects it immediately without contacting the dependency.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.