Interface CircuitBreaker
public interface CircuitBreaker
A circuit breaker, which tracks the number of
success/failure requests and detects a remote service failure.
-
Method Summary
Modifier and Type Method Description static CircuitBreakerBuilder
builder()
Returns a newCircuitBreakerBuilder
.static CircuitBreakerBuilder
builder(String name)
Returns a newCircuitBreakerBuilder
that has the specified name.boolean
canRequest()
Decides whether a request should be sent or failed depending on the current circuit state.String
name()
Returns the name of the circuit breaker.static CircuitBreaker
of(String name)
Creates a newCircuitBreaker
that has the specified name and the default configurations.static CircuitBreaker
ofDefaultName()
Creates a newCircuitBreaker
that has a default name and the default configurations.void
onFailure()
Reports a remote invocation failure.void
onSuccess()
Reports a remote invocation success.
-
Method Details
-
builder
Returns a newCircuitBreakerBuilder
. -
builder
Returns a newCircuitBreakerBuilder
that has the specified name.- Parameters:
name
- the name of the circuit breaker.
-
of
Creates a newCircuitBreaker
that has the specified name and the default configurations.- Parameters:
name
- the name of the circuit breaker
-
ofDefaultName
Creates a newCircuitBreaker
that has a default name and the default configurations. -
name
String name()Returns the name of the circuit breaker. -
onSuccess
void onSuccess()Reports a remote invocation success. -
onFailure
void onFailure()Reports a remote invocation failure. -
canRequest
boolean canRequest()Decides whether a request should be sent or failed depending on the current circuit state.
-