public class CircuitBreakerOptions extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_MAX_FAILURES
Default number of failures.
|
static long |
DEFAULT_TIMEOUT
Default timeout in milliseconds.
|
| Constructor and Description |
|---|
CircuitBreakerOptions()
Creates a new instance of
CircuitBreakerOptions using the default values. |
CircuitBreakerOptions(CircuitBreakerOptions other)
Creates a new instance of
CircuitBreakerOptions by copying the other instance. |
CircuitBreakerOptions(JsonObject json)
Creates a new instance of
CircuitBreakerOptions from the given json object. |
| Modifier and Type | Method and Description |
|---|---|
int |
getMaxFailures() |
String |
getNotificationAddress() |
long |
getNotificationPeriod() |
long |
getResetTimeout() |
long |
getTimeout() |
boolean |
isFallbackOnFailure() |
CircuitBreakerOptions |
setFallbackOnFailure(boolean fallbackOnFailure)
Sets whether or not the fallback is executed on failure, even when the circuit is closed.
|
CircuitBreakerOptions |
setMaxFailures(int maxFailures)
Sets the maximum number of failures before opening the circuit.
|
CircuitBreakerOptions |
setNotificationAddress(String notificationAddress)
Sets the event bus address on which the circuit breaker publish its state change.
|
CircuitBreakerOptions |
setNotificationPeriod(long notificationPeriod)
Configures the period in milliseconds where the circuit breaker send a notification on the event bus with its
current state.
|
CircuitBreakerOptions |
setResetTimeout(long resetTimeout)
Sets the time in ms before it attempts to re-close the circuit (by going to the hal-open state).
|
CircuitBreakerOptions |
setTimeout(long timeoutInMs)
Sets the timeout in milliseconds.
|
JsonObject |
toJson() |
public static final long DEFAULT_TIMEOUT
public static final int DEFAULT_MAX_FAILURES
public CircuitBreakerOptions()
CircuitBreakerOptions using the default values.public CircuitBreakerOptions(CircuitBreakerOptions other)
CircuitBreakerOptions by copying the other instance.other - the instance fo copypublic CircuitBreakerOptions(JsonObject json)
CircuitBreakerOptions from the given json object.json - the json objectpublic JsonObject toJson()
public int getMaxFailures()
public CircuitBreakerOptions setMaxFailures(int maxFailures)
maxFailures - the number of failures.CircuitBreakerOptions instancepublic long getTimeout()
public CircuitBreakerOptions setTimeout(long timeoutInMs)
timeoutInMs - the timeout, -1 to disable the timeoutCircuitBreakerOptions instancepublic boolean isFallbackOnFailure()
public CircuitBreakerOptions setFallbackOnFailure(boolean fallbackOnFailure)
fallbackOnFailure - true to enable it.CircuitBreakerOptions instancepublic long getResetTimeout()
public CircuitBreakerOptions setResetTimeout(long resetTimeout)
-1 disables this feature.resetTimeout - the time in msCircuitBreakerOptions instancepublic String getNotificationAddress()
null if this feature has
been disabled.public CircuitBreakerOptions setNotificationAddress(String notificationAddress)
notificationAddress - the address, null to disable this feature.CircuitBreakerOptions instancepublic long getNotificationPeriod()
public CircuitBreakerOptions setNotificationPeriod(long notificationPeriod)
notificationPeriod - the period, 0 to disable this feature.CircuitBreaker instanceCopyright © 2016. All rights reserved.