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 TypeMethodDescriptionstatic CircuitBreakerBuilder
builder()
Returns a newCircuitBreakerBuilder
.static CircuitBreakerBuilder
Returns a newCircuitBreakerBuilder
that has the specified name.boolean
Decides whether a request should be sent or failed depending on the current circuit state.name()
Returns the name of the circuit breaker.static CircuitBreaker
Creates a newCircuitBreaker
that has the specified name and the default configurations.static CircuitBreaker
Creates a newCircuitBreaker
that has a default name and the default configurations.void
Reports a remote invocation failure.void
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.
-