public class CircuitBreakerOptions extends Object
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_FALLBACK_ON_FAILURE
Default value of the fallback on failure property.
|
static int |
DEFAULT_MAX_FAILURES
Default number of failures.
|
static int |
DEFAULT_METRICS_ROLLING_BUCKETS
Default number of buckets used for the rolling window.
|
static long |
DEFAULT_METRICS_ROLLING_WINDOW
Default rolling window for metrics in milliseconds.
|
static String |
DEFAULT_NOTIFICATION_ADDRESS
A default address on which the circuit breakers can send their updates.
|
static boolean |
DEFAULT_NOTIFICATION_LOCAL_ONLY
Whether circuit breaker state should be delivered only to local consumers by default =
true . |
static long |
DEFAULT_NOTIFICATION_PERIOD
Default notification period in milliseconds.
|
static long |
DEFAULT_RESET_TIMEOUT
Default time before it attempts to re-close the circuit (half-open state) in milliseconds.
|
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 |
---|---|
long |
getFailuresRollingWindow() |
int |
getMaxFailures() |
int |
getMaxRetries() |
int |
getMetricsRollingBuckets() |
long |
getMetricsRollingWindow() |
String |
getNotificationAddress() |
long |
getNotificationPeriod() |
long |
getResetTimeout() |
long |
getTimeout() |
boolean |
isFallbackOnFailure() |
boolean |
isNotificationLocalOnly() |
CircuitBreakerOptions |
setFailuresRollingWindow(long failureRollingWindow)
Sets the rolling window used for metrics.
|
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 |
setMaxRetries(int maxRetries)
Configures the number of times the circuit breaker tries to redo the operation before failing.
|
CircuitBreakerOptions |
setMetricsRollingBuckets(int metricsRollingBuckets)
Sets the configured number of buckets the rolling window is divided into.
|
CircuitBreakerOptions |
setMetricsRollingWindow(long metricsRollingWindow)
Sets the rolling window used for metrics.
|
CircuitBreakerOptions |
setNotificationAddress(String notificationAddress)
Sets the event bus address on which the circuit breaker publish its state change.
|
CircuitBreakerOptions |
setNotificationLocalOnly(boolean notificationLocalOnly)
Whether circuit breaker state should be delivered only to local consumers.
|
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 half-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 static final boolean DEFAULT_FALLBACK_ON_FAILURE
public static final long DEFAULT_RESET_TIMEOUT
public static final boolean DEFAULT_NOTIFICATION_LOCAL_ONLY
true
.public static final String DEFAULT_NOTIFICATION_ADDRESS
public static final long DEFAULT_NOTIFICATION_PERIOD
public static final long DEFAULT_METRICS_ROLLING_WINDOW
public static final int DEFAULT_METRICS_ROLLING_BUCKETS
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 boolean isNotificationLocalOnly()
true
if circuit breaker state should be delivered only to local consumers, otherwise false
public CircuitBreakerOptions setNotificationLocalOnly(boolean notificationLocalOnly)
notificationLocalOnly
- true
if circuit breaker state should be delivered only to local consumers, otherwise false
CircuitBreakerOptions
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.CircuitBreakerOptions
instancepublic long getMetricsRollingWindow()
public CircuitBreakerOptions setMetricsRollingWindow(long metricsRollingWindow)
metricsRollingWindow
- the period in milliseconds.CircuitBreakerOptions
instancepublic long getFailuresRollingWindow()
public CircuitBreakerOptions setFailuresRollingWindow(long failureRollingWindow)
metricsRollingWindow
- the period in milliseconds.CircuitBreakerOptions
instancepublic int getMetricsRollingBuckets()
public CircuitBreakerOptions setMetricsRollingBuckets(int metricsRollingBuckets)
metricsRollingBuckets
- the number of rolling buckets.CircuitBreakerOptions
instancepublic int getMaxRetries()
public CircuitBreakerOptions setMaxRetries(int maxRetries)
maxRetries
- the number of retries, 0 to disable this feature.CircuitBreakerOptions
instanceCopyright © 2024 Eclipse. All rights reserved.