Class CircuitBreakerConfig
- java.lang.Object
-
- io.github.resilience4j.circuitbreaker.CircuitBreakerConfig
-
- All Implemented Interfaces:
java.io.Serializable
public class CircuitBreakerConfig extends java.lang.Object implements java.io.Serializable
ACircuitBreakerConfig
configures aCircuitBreaker
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
CircuitBreakerConfig.Builder
static class
CircuitBreakerConfig.SlidingWindowType
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_FAILURE_RATE_THRESHOLD
static int
DEFAULT_MINIMUM_NUMBER_OF_CALLS
static int
DEFAULT_PERMITTED_CALLS_IN_HALF_OPEN_STATE
static int
DEFAULT_SLIDING_WINDOW_SIZE
static CircuitBreakerConfig.SlidingWindowType
DEFAULT_SLIDING_WINDOW_TYPE
static int
DEFAULT_SLOW_CALL_DURATION_THRESHOLD
static int
DEFAULT_SLOW_CALL_RATE_THRESHOLD
static int
DEFAULT_WAIT_DURATION_IN_HALF_OPEN_STATE
static int
DEFAULT_WAIT_DURATION_IN_OPEN_STATE
static boolean
DEFAULT_WRITABLE_STACK_TRACE_ENABLED
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description static CircuitBreakerConfig.Builder
custom()
Returns a builder to create a custom CircuitBreakerConfig.static CircuitBreakerConfig.Builder
from(CircuitBreakerConfig baseConfig)
Returns a builder to create a custom CircuitBreakerConfig based on another CircuitBreakerConfig.java.util.function.Function<java.time.Clock,java.lang.Long>
getCurrentTimestampFunction()
float
getFailureRateThreshold()
java.util.function.Predicate<java.lang.Throwable>
getIgnoreExceptionPredicate()
java.time.Duration
getMaxWaitDurationInHalfOpenState()
int
getMinimumNumberOfCalls()
int
getPermittedNumberOfCallsInHalfOpenState()
java.util.function.Predicate<java.lang.Throwable>
getRecordExceptionPredicate()
int
getSlidingWindowSize()
CircuitBreakerConfig.SlidingWindowType
getSlidingWindowType()
java.time.Duration
getSlowCallDurationThreshold()
float
getSlowCallRateThreshold()
java.util.concurrent.TimeUnit
getTimestampUnit()
java.time.Duration
getWaitDurationInOpenState()
Deprecated.since 1.2.0 You should usegetWaitIntervalFunctionInOpenState()
instead.io.github.resilience4j.core.IntervalFunction
getWaitIntervalFunctionInOpenState()
Returns an interval function which controls how long the CircuitBreaker should stay open, before it switches to half open.boolean
isAutomaticTransitionFromOpenToHalfOpenEnabled()
boolean
isWritableStackTraceEnabled()
static CircuitBreakerConfig
ofDefaults()
Creates a default CircuitBreaker configuration.java.lang.String
toString()
-
-
-
Field Detail
-
DEFAULT_FAILURE_RATE_THRESHOLD
public static final int DEFAULT_FAILURE_RATE_THRESHOLD
- See Also:
- Constant Field Values
-
DEFAULT_SLOW_CALL_RATE_THRESHOLD
public static final int DEFAULT_SLOW_CALL_RATE_THRESHOLD
- See Also:
- Constant Field Values
-
DEFAULT_WAIT_DURATION_IN_OPEN_STATE
public static final int DEFAULT_WAIT_DURATION_IN_OPEN_STATE
- See Also:
- Constant Field Values
-
DEFAULT_PERMITTED_CALLS_IN_HALF_OPEN_STATE
public static final int DEFAULT_PERMITTED_CALLS_IN_HALF_OPEN_STATE
- See Also:
- Constant Field Values
-
DEFAULT_MINIMUM_NUMBER_OF_CALLS
public static final int DEFAULT_MINIMUM_NUMBER_OF_CALLS
- See Also:
- Constant Field Values
-
DEFAULT_SLIDING_WINDOW_SIZE
public static final int DEFAULT_SLIDING_WINDOW_SIZE
- See Also:
- Constant Field Values
-
DEFAULT_SLOW_CALL_DURATION_THRESHOLD
public static final int DEFAULT_SLOW_CALL_DURATION_THRESHOLD
- See Also:
- Constant Field Values
-
DEFAULT_WAIT_DURATION_IN_HALF_OPEN_STATE
public static final int DEFAULT_WAIT_DURATION_IN_HALF_OPEN_STATE
- See Also:
- Constant Field Values
-
DEFAULT_SLIDING_WINDOW_TYPE
public static final CircuitBreakerConfig.SlidingWindowType DEFAULT_SLIDING_WINDOW_TYPE
-
DEFAULT_WRITABLE_STACK_TRACE_ENABLED
public static final boolean DEFAULT_WRITABLE_STACK_TRACE_ENABLED
- See Also:
- Constant Field Values
-
-
Method Detail
-
custom
public static CircuitBreakerConfig.Builder custom()
Returns a builder to create a custom CircuitBreakerConfig.- Returns:
- a
CircuitBreakerConfig.Builder
-
from
public static CircuitBreakerConfig.Builder from(CircuitBreakerConfig baseConfig)
Returns a builder to create a custom CircuitBreakerConfig based on another CircuitBreakerConfig.- Returns:
- a
CircuitBreakerConfig.Builder
-
ofDefaults
public static CircuitBreakerConfig ofDefaults()
Creates a default CircuitBreaker configuration.- Returns:
- a default CircuitBreaker configuration.
-
getFailureRateThreshold
public float getFailureRateThreshold()
-
getWaitDurationInOpenState
@Deprecated public java.time.Duration getWaitDurationInOpenState()
Deprecated.since 1.2.0 You should usegetWaitIntervalFunctionInOpenState()
instead.
-
getWaitIntervalFunctionInOpenState
public io.github.resilience4j.core.IntervalFunction getWaitIntervalFunctionInOpenState()
Returns an interval function which controls how long the CircuitBreaker should stay open, before it switches to half open.- Returns:
- the CircuitBreakerConfig.Builder
-
getSlidingWindowSize
public int getSlidingWindowSize()
-
getRecordExceptionPredicate
public java.util.function.Predicate<java.lang.Throwable> getRecordExceptionPredicate()
-
getIgnoreExceptionPredicate
public java.util.function.Predicate<java.lang.Throwable> getIgnoreExceptionPredicate()
-
getCurrentTimestampFunction
public java.util.function.Function<java.time.Clock,java.lang.Long> getCurrentTimestampFunction()
-
getTimestampUnit
public java.util.concurrent.TimeUnit getTimestampUnit()
-
isAutomaticTransitionFromOpenToHalfOpenEnabled
public boolean isAutomaticTransitionFromOpenToHalfOpenEnabled()
-
getMinimumNumberOfCalls
public int getMinimumNumberOfCalls()
-
isWritableStackTraceEnabled
public boolean isWritableStackTraceEnabled()
-
getPermittedNumberOfCallsInHalfOpenState
public int getPermittedNumberOfCallsInHalfOpenState()
-
getSlidingWindowType
public CircuitBreakerConfig.SlidingWindowType getSlidingWindowType()
-
getSlowCallRateThreshold
public float getSlowCallRateThreshold()
-
getSlowCallDurationThreshold
public java.time.Duration getSlowCallDurationThreshold()
-
getMaxWaitDurationInHalfOpenState
public java.time.Duration getMaxWaitDurationInHalfOpenState()
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-