Interface CircuitBreaker
-
public interface CircuitBreaker
A circuit breaker, which tracks the number of success/failure requests and detects a remote service failure.
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Modifier and Type Method Description 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 Detail
-
of
static CircuitBreaker of(String name)
Creates a newCircuitBreaker
that has the specified name and the default configurations.- Parameters:
name
- the name of the circuit breaker
-
ofDefaultName
static CircuitBreaker 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.
-
-