Spring / Resilience4j Interview questions
Explain the internal working of automaticTransitionFromOpenToHalfOpenEnabled?
By default this flag is false, which means the CircuitBreaker doesn't proactively schedule a background timer to flip itself from OPEN to HALF_OPEN - instead, the transition is evaluated lazily, checked only when the next call actually arrives after waitDurationInOpenState has elapsed.
Setting it to true makes the breaker schedule an internal timer that performs the OPEN→HALF_OPEN transition on its own once the wait duration passes, even if no calls come in at all during that window.
The practical difference shows up on low-traffic services: with the flag false, a service that gets no calls for an hour after opening could stay OPEN well past its intended wait duration, because nothing ever triggers the lazy check; with it true, the breaker transitions to HALF_OPEN on schedule regardless of traffic, so the very next call - whenever it arrives - gets treated as a proper trial call instead of finding the breaker still technically OPEN long after it should have moved on.
More Related questions...