//arrow-fx-coroutines/arrow.fx.coroutines/CircuitBreaker/State

State

common sealed class State

The initial state when initializing a CircuitBreaker is Closed.

The available states are:

  • [Closed](-closed/index.html) in case tasks are allowed to go through
  • [Open](-open/index.html) in case the circuit breaker is active and rejects incoming tasks
  • [HalfOpen](-half-open/index.html) in case a reset attempt was triggered and it is waiting for the result in order to evolve in [Closed](-closed/index.html), or back to [Open](-open/index.html)

Types

Name Summary
Closed common class Closed(failures: Int) : CircuitBreaker.State
Closed is the normal state of the CircuitBreaker, where requests are being made. The state in which CircuitBreaker starts. - When an exceptions occurs it increments the failure counter - A successful request will reset the failure counter to zero - When the failure counter reaches the maxFailures threshold, the breaker is tripped into the Open state
HalfOpen common class HalfOpen : CircuitBreaker.State
The CircuitBreaker is in HalfOpen state while it’s allowing a test request to go through.
Open common class Open : CircuitBreaker.State
When the CircuitBreaker is in the Open state it will short-circuit/fail-fast all requests - All requests short-circuit/fail-fast with ExecutionRejected - If a request is made after the configured resetTimeout passes, the CircuitBreaker is tripped into the a HalfOpen state, allowing one request to go through as a test.

Inheritors

Name
CircuitBreaker.State
CircuitBreaker.State
CircuitBreaker.State

Do you like Arrow?

Arrow Org
<