public abstract class CircuitBreaker extends Object
ServiceCall
. A circuit breaker is used to provide stability and prevent cascading
failures in distributed systems. An example would be to begin to fail-fast after some number of
failures due to a dependency on a hanging call.Modifier and Type | Class and Description |
---|---|
static class |
CircuitBreaker.CircuitBreakerId |
static class |
CircuitBreaker.NamedCircuitBreaker
A named circuit breaker.
|
Modifier and Type | Method and Description |
---|---|
static CircuitBreaker |
identifiedBy(String id)
Use a circuit breaker identified by the given circuit breaker ID.
|
static CircuitBreaker |
none()
Do not use a Circuit breaker for this service call.
|
static CircuitBreaker |
perNode()
Use a circuit breaker per node, if supported.
|
static CircuitBreaker |
perService()
Use a circuit breaker per service.
|
public static CircuitBreaker none()
public static CircuitBreaker perNode()
Service locators that support per node circuit breaking will typically also remove the node from their routing pool while the circuit breaker is open, and bring it in for one call when it's half open.
If not supported by the service locator, a circuit breaker per service may be used.
public static CircuitBreaker perService()
public static CircuitBreaker identifiedBy(String id)
id
- The ID of the circuit breaker.