- All Superinterfaces:
FtHandler
CircuitBreaker protects a potentially failing endpoint from overloading and the application
from spending resources on those endpoints.
In case too many errors are detected, the circuit opens and all new requests fail with a
CircuitBreakerOpenException for a period of time.
After this period, attempts are made to check if the service is up again - if so, the circuit closes
and requests can process as usual again.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic classFluent API builder forCircuitBreaker.static enumA circuit breaker can be in any of 3 possible states as defined by this enum. -
Method Summary
Modifier and TypeMethodDescriptionstatic CircuitBreaker.Builderbuilder()Builder to customize configuration of the breaker.state()Current breaker state.voidstate(CircuitBreaker.State newState) Set state of this circuit breaker.Methods inherited from interface io.helidon.faulttolerance.FtHandler
invoke, invokeMulti, name
-
Method Details
-
builder
Builder to customize configuration of the breaker.- Returns:
- a new builder
-
state
CircuitBreaker.State state()Current breaker state. As the state may change within nanoseconds, this is for information only.- Returns:
- current breaker state
-
state
Set state of this circuit breaker. Note that all usual processes to re-close or open the circuit are in progress.- If set to
CircuitBreaker.State.OPEN, a timer will set it to half open in a while - If set to
CircuitBreaker.State.HALF_OPEN, it may close after first successful request - If set to
CircuitBreaker.State.CLOSED, it may open again if requests fail
state()may yield a different state than configured here- Parameters:
newState- state to configure
- If set to
-