Spring / Resilience4j Interview questions
How does the half-open state behave in a CircuitBreaker?
HALF_OPEN is a probationary state the breaker enters after waitDurationInOpenState elapses, meant to test whether the dependency has actually recovered before fully reopening traffic.
Only permittedNumberOfCallsInHalfOpenState trial calls are allowed through; every other call is still rejected exactly as in OPEN, so a handful of real calls decide the outcome rather than the full traffic volume.
If enough of those trial calls succeed to bring the failure rate back under failureRateThreshold, the breaker transitions to CLOSED; if they fail, it immediately reopens and restarts the wait timer, rather than lingering in HALF_OPEN indefinitely.
Whether the breaker even makes this OPEN→HALF_OPEN move automatically, versus waiting for a manual/explicit transition, depends on automaticTransitionFromOpenToHalfOpenEnabled.
More Related questions...