Package com.oracle.bmc.circuitbreaker
Class CircuitBreakerConfiguration
- java.lang.Object
-
- com.oracle.bmc.circuitbreaker.CircuitBreakerConfiguration
-
- Direct Known Subclasses:
NoCircuitBreakerConfiguration
public class CircuitBreakerConfiguration extends Object
ACircuitBreakerConfigurationconfigures a circuit breakerSetting an invocation response timeout lower that the slow call threshold will bypass the intended effect of the circuit breaker
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classCircuitBreakerConfiguration.CircuitBreakerConfigurationBuilder
-
Field Summary
Fields Modifier and Type Field Description static intBAD_GATEWAYstatic intDEFAULT_FAILURE_RATE_THRESHOLDstatic intDEFAULT_MAX_WAIT_DURATION_IN_HALF_OPEN_STATEstatic intDEFAULT_MINIMUM_NUMBER_OF_CALLSstatic intDEFAULT_PERMITTED_CALLS_IN_HALF_OPEN_STATEstatic intDEFAULT_SLIDING_WINDOW_SIZEstatic intDEFAULT_SLOW_CALL_DURATION_THRESHOLDstatic intDEFAULT_SLOW_CALL_RATE_THRESHOLDstatic intDEFAULT_WAIT_DURATION_IN_OPEN_STATEstatic booleanDEFAULT_WRITABLE_STACK_TRACE_ENABLEDstatic StringDIAGNOSTIC_SUMMARY_ENABLED_PROPERTYSet this JVM system property to true to include the opening diagnostic summary in circuit-breaker rejection messages.static intGATEWAY_TIMEOUTstatic intINTERNAL_SERVER_ERRORstatic intNUMBER_OF_RECORDED_HISTORY_RESPONSESstatic intSERVICE_UNAVAILABLEstatic intTOO_MANY_REQUESTS
-
Constructor Summary
Constructors Modifier Constructor Description CircuitBreakerConfiguration()protectedCircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures)protectedCircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures, int numberOfRecordedHistoryResponses)Usebuilder()instead.protectedCircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures, int numberOfRecordedHistoryResponses, Duration maxWaitDurationInHalfOpenState)protectedCircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures, int numberOfRecordedHistoryResponses, Duration maxWaitDurationInHalfOpenState, CircuitBreakerEventListener circuitBreakerEventListener)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static CircuitBreakerConfiguration.CircuitBreakerConfigurationBuilderbuilder()CircuitBreakerEventListenergetCircuitBreakerEventListener()intgetFailureRateThreshold()DurationgetMaxWaitDurationInHalfOpenState()Returns the HALF_OPEN timeout (default: 30 seconds).intgetMinimumNumberOfCalls()intgetNumberOfRecordedHistoryResponses()intgetPermittedNumberOfCallsInHalfOpenState()List<Class<? extends RuntimeException>>getRecordExceptions()Set<Integer>getRecordHttpStatuses()intgetSlidingWindowSize()DurationgetSlowCallDurationThreshold()intgetSlowCallRateThreshold()DurationgetWaitDurationInOpenState()static booleanisDiagnosticSummaryEnabled()Returns whether opening diagnostic summaries should be included in rejection messages.booleanisRecordProcessingFailures()booleanisWritableStackTraceEnabled()
-
-
-
Field Detail
-
DIAGNOSTIC_SUMMARY_ENABLED_PROPERTY
public static final String DIAGNOSTIC_SUMMARY_ENABLED_PROPERTY
Set this JVM system property to true to include the opening diagnostic summary in circuit-breaker rejection messages.Defaults to false; snapshot collection and recent failure history are unaffected.
- See Also:
- Constant Field Values
-
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_MAX_WAIT_DURATION_IN_HALF_OPEN_STATE
public static final int DEFAULT_MAX_WAIT_DURATION_IN_HALF_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_WRITABLE_STACK_TRACE_ENABLED
public static final boolean DEFAULT_WRITABLE_STACK_TRACE_ENABLED
- See Also:
- Constant Field Values
-
NUMBER_OF_RECORDED_HISTORY_RESPONSES
public static final int NUMBER_OF_RECORDED_HISTORY_RESPONSES
- See Also:
- Constant Field Values
-
TOO_MANY_REQUESTS
public static final int TOO_MANY_REQUESTS
- See Also:
- Constant Field Values
-
INTERNAL_SERVER_ERROR
public static final int INTERNAL_SERVER_ERROR
- See Also:
- Constant Field Values
-
SERVICE_UNAVAILABLE
public static final int SERVICE_UNAVAILABLE
- See Also:
- Constant Field Values
-
BAD_GATEWAY
public static final int BAD_GATEWAY
- See Also:
- Constant Field Values
-
GATEWAY_TIMEOUT
public static final int GATEWAY_TIMEOUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CircuitBreakerConfiguration
protected CircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures)
-
CircuitBreakerConfiguration
@ConstructorProperties({"failureRateThreshold","slowCallRateThreshold","waitDurationInOpenState","permittedNumberOfCallsInHalfOpenState","minimumNumberOfCalls","slidingWindowSize","slowCallDurationThreshold","writableStackTraceEnabled","recordHttpStatuses","recordExceptions","numberOfRecordedHistoryResponses"}) protected CircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures, int numberOfRecordedHistoryResponses)
Usebuilder()instead.- Parameters:
failureRateThreshold-slowCallRateThreshold-waitDurationInOpenState-permittedNumberOfCallsInHalfOpenState-minimumNumberOfCalls-slidingWindowSize-slowCallDurationThreshold-writableStackTraceEnabled-recordHttpStatuses-recordExceptions-recordProcessingFailures-numberOfRecordedHistoryResponses-
-
CircuitBreakerConfiguration
@ConstructorProperties({"failureRateThreshold","slowCallRateThreshold","waitDurationInOpenState","permittedNumberOfCallsInHalfOpenState","minimumNumberOfCalls","slidingWindowSize","slowCallDurationThreshold","writableStackTraceEnabled","recordHttpStatuses","recordExceptions","recordProcessingFailures","numberOfRecordedHistoryResponses","maxWaitDurationInHalfOpenState"}) protected CircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures, int numberOfRecordedHistoryResponses, Duration maxWaitDurationInHalfOpenState)
-
CircuitBreakerConfiguration
@ConstructorProperties({"failureRateThreshold","slowCallRateThreshold","waitDurationInOpenState","permittedNumberOfCallsInHalfOpenState","minimumNumberOfCalls","slidingWindowSize","slowCallDurationThreshold","writableStackTraceEnabled","recordHttpStatuses","recordExceptions","recordProcessingFailures","numberOfRecordedHistoryResponses","maxWaitDurationInHalfOpenState","circuitBreakerEventListener"}) protected CircuitBreakerConfiguration(int failureRateThreshold, int slowCallRateThreshold, Duration waitDurationInOpenState, int permittedNumberOfCallsInHalfOpenState, int minimumNumberOfCalls, int slidingWindowSize, Duration slowCallDurationThreshold, boolean writableStackTraceEnabled, Set<Integer> recordHttpStatuses, List<Class<? extends RuntimeException>> recordExceptions, boolean recordProcessingFailures, int numberOfRecordedHistoryResponses, Duration maxWaitDurationInHalfOpenState, CircuitBreakerEventListener circuitBreakerEventListener)
-
CircuitBreakerConfiguration
public CircuitBreakerConfiguration()
-
-
Method Detail
-
isDiagnosticSummaryEnabled
public static boolean isDiagnosticSummaryEnabled()
Returns whether opening diagnostic summaries should be included in rejection messages.
-
builder
public static CircuitBreakerConfiguration.CircuitBreakerConfigurationBuilder builder()
-
getFailureRateThreshold
public int getFailureRateThreshold()
-
getSlowCallRateThreshold
public int getSlowCallRateThreshold()
-
getWaitDurationInOpenState
public Duration getWaitDurationInOpenState()
-
getMaxWaitDurationInHalfOpenState
public Duration getMaxWaitDurationInHalfOpenState()
Returns the HALF_OPEN timeout (default: 30 seconds).Expiry reopens the breaker without cancelling in-flight HTTP requests. Validated when the circuit breaker is created.
-
getPermittedNumberOfCallsInHalfOpenState
public int getPermittedNumberOfCallsInHalfOpenState()
-
getMinimumNumberOfCalls
public int getMinimumNumberOfCalls()
-
getSlidingWindowSize
public int getSlidingWindowSize()
-
getSlowCallDurationThreshold
public Duration getSlowCallDurationThreshold()
-
isWritableStackTraceEnabled
public boolean isWritableStackTraceEnabled()
-
getNumberOfRecordedHistoryResponses
public int getNumberOfRecordedHistoryResponses()
-
getRecordExceptions
public List<Class<? extends RuntimeException>> getRecordExceptions()
-
isRecordProcessingFailures
public boolean isRecordProcessingFailures()
-
getCircuitBreakerEventListener
public CircuitBreakerEventListener getCircuitBreakerEventListener()
-
-