Class CircuitOpenException
java.lang.Object
java.lang.Throwable
java.lang.Exception
java.lang.RuntimeException
com.eqixiac.equinix.core.exception.BaseException
com.eqixiac.equinix.core.exception.EquinixClientException
com.eqixiac.equinix.core.exception.CircuitOpenException
- All Implemented Interfaces:
Serializable
Thrown when the opt-in
CircuitBreaker is open and a request
was rejected without being sent to the API. The breaker opens after a configured number
of consecutive service failures (5xx responses or transport IOExceptions) and rejects
requests until its cooldown elapses, at which point a single probe request is let through.
This is a client-side rejection - no HTTP exchange took place - so it extends
EquinixClientException rather than EquinixServiceException. Callers can wait for
getRemainingCooldownMillis() before retrying.
- Author:
- ianjones
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionCircuitOpenException(String message, long remainingCooldownMillis) Creates a rejection for a request refused while the circuit is open. -
Method Summary
Modifier and TypeMethodDescriptionlongHow long until the breaker transitions to half-open and admits a probe request.Methods inherited from class Throwable
addSuppressed, fillInStackTrace, getCause, getLocalizedMessage, getMessage, getStackTrace, getSuppressed, initCause, printStackTrace, printStackTrace, printStackTrace, setStackTrace, toString
-
Constructor Details
-
CircuitOpenException
Creates a rejection for a request refused while the circuit is open.- Parameters:
message- a human-readable summary of why the request was rejectedremainingCooldownMillis- how long (in millis) until the breaker will admit a probe request
-
-
Method Details
-
getRemainingCooldownMillis
public long getRemainingCooldownMillis()How long until the breaker transitions to half-open and admits a probe request.- Returns:
- the remaining cooldown in milliseconds (never negative)
-