Let's take a look at the state diagram in more detail:
A circuit breaker starts as Closed, allowing requests to be processed.
As long as the requests are processed successfully, it stays in the Closed state.
If failures start to happen, a counter starts to count up.
If a threshold of failures is reached within a specified period of time, the circuit breaker will trip, that is, go to the Open state, not allowing further requests to be processed. Both the threshold of failures and the period of time are configurable.
Instead, a request will Fast Fail, meaning it will return immediately with an exception.
After a configurable period of time, the circuit breaker will enter a Half Open state and allow one request to go through, as a probe, to see whether the failure has been resolved.
If the probe request fails, the circuit breaker goes back to the Open state.
If the probe request succeeds, the circuit breaker goes to the initial Closed state, allowing new requests to be processed.