Class ResilienceConfiguration.CircuitBreakerConfiguration

java.lang.Object
com.sap.cloud.sdk.cloudplatform.resilience.ResilienceConfiguration.CircuitBreakerConfiguration
Enclosing class:
ResilienceConfiguration

public static final class ResilienceConfiguration.CircuitBreakerConfiguration extends Object
Provides options specific to circuit breakers.
See Also:
  • Field Details

    • DEFAULT_FAILURE_RATE_THRESHOLD

      public static final float DEFAULT_FAILURE_RATE_THRESHOLD
      The default threshold at which to transition to the OPEN state.
      See Also:
    • DEFAULT_CLOSED_BUFFER_SIZE

      public static final int DEFAULT_CLOSED_BUFFER_SIZE
      The default size of the buffer in CLOSED state.
      See Also:
    • DEFAULT_HALF_OPEN_BUFFER_SIZE

      public static final int DEFAULT_HALF_OPEN_BUFFER_SIZE
      The default size of the buffer in HALF OPEN state.
      See Also:
    • DEFAULT_WAIT_DURATION

      public static final Duration DEFAULT_WAIT_DURATION
      The default duration to wait in OPEN state before transitioning into the HALF OPEN state.
    • DEFAULT_SLOW_CALL_DURATION_THRESHOLD

      public static final Duration DEFAULT_SLOW_CALL_DURATION_THRESHOLD
      The default duration threshold above which calls are considered as slow. Matches the Resilience4j default of 60 seconds.
    • DEFAULT_SLOW_CALL_RATE_THRESHOLD

      public static final float DEFAULT_SLOW_CALL_RATE_THRESHOLD
      The default slow call rate threshold (as percentage within [0, 100]). Matches the Resilience4j default of 100%.
      See Also:
  • Method Details

    • isEnabled

      public boolean isEnabled()
      Get the status indicator for the CircuitBreaker.
      Returns:
      True if the configuration is enabled.
    • disabled

      @Nonnull public static ResilienceConfiguration.CircuitBreakerConfiguration disabled()
      Creates a disabled CircuitBreakerConfiguration.
      Returns:
      A disabled time limiter.
    • of

    • equals

      public boolean equals(@Nullable Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • failureRateThreshold

      public float failureRateThreshold()
      The failure rate threshold (as percentage within [0, 100]).
    • waitDuration

      @Nonnull public Duration waitDuration()
      The wait duration in the OPEN state before transitioning into the HALF OPEN state.
    • closedBufferSize

      public int closedBufferSize()
      The number of latest attempts in the CLOSED state to apply the threshold to. If the failure rate over the last closedRingBufferSize calls exceeds the threshold, the circuit breaker will block further calls (OPEN state). Be aware that this is the minimum number of attempts that must have occurred before the circuit breaker can take effect.
    • halfOpenBufferSize

      public int halfOpenBufferSize()
      The number of latest attempts in the HALF OPEN state to apply the threshold to. Sets the amount of attempts after which the circuit breaker will transition back to the CLOSED or OPEN state. Furthermore, this is the maximum number of requests that may take place in parallel during the HALF OPEN state.
    • slowCallDurationThreshold

      @Nonnull public Duration slowCallDurationThreshold()
      The duration threshold above which calls are considered as slow and increase the slow call rate. When the percentage of slow calls is equal to or greater than slowCallRateThreshold, the CircuitBreaker transitions to OPEN and starts short-circuiting calls.
      Since:
      5.29.0
    • slowCallRateThreshold

      public float slowCallRateThreshold()
      The slow call rate threshold (as percentage within [0, 100]). The CircuitBreaker considers a call as slow when the call duration is greater than slowCallDurationThreshold. When the percentage of slow calls is equal to or greater than the threshold, the CircuitBreaker transitions to OPEN and starts short-circuiting calls.
      Since:
      5.29.0
    • failureRateThreshold

      @Nonnull public ResilienceConfiguration.CircuitBreakerConfiguration failureRateThreshold(float failureRateThreshold)
      The failure rate threshold (as percentage within [0, 100]).
      Returns:
      this.
    • waitDuration

      @Nonnull public ResilienceConfiguration.CircuitBreakerConfiguration waitDuration(@Nonnull Duration waitDuration)
      The wait duration in the OPEN state before transitioning into the HALF OPEN state.
      Returns:
      this.
    • closedBufferSize

      @Nonnull public ResilienceConfiguration.CircuitBreakerConfiguration closedBufferSize(int closedBufferSize)
      The number of latest attempts in the CLOSED state to apply the threshold to. If the failure rate over the last closedRingBufferSize calls exceeds the threshold, the circuit breaker will block further calls (OPEN state). Be aware that this is the minimum number of attempts that must have occurred before the circuit breaker can take effect.
      Returns:
      this.
    • halfOpenBufferSize

      @Nonnull public ResilienceConfiguration.CircuitBreakerConfiguration halfOpenBufferSize(int halfOpenBufferSize)
      The number of latest attempts in the HALF OPEN state to apply the threshold to. Sets the amount of attempts after which the circuit breaker will transition back to the CLOSED or OPEN state. Furthermore, this is the maximum number of requests that may take place in parallel during the HALF OPEN state.
      Returns:
      this.
    • slowCallDurationThreshold

      @Nonnull public ResilienceConfiguration.CircuitBreakerConfiguration slowCallDurationThreshold(@Nonnull Duration slowCallDurationThreshold)
      The duration threshold above which calls are considered as slow and increase the slow call rate. When the percentage of slow calls is equal to or greater than slowCallRateThreshold, the CircuitBreaker transitions to OPEN and starts short-circuiting calls.
      Returns:
      this.
      Since:
      5.29.0
    • slowCallRateThreshold

      @Nonnull public ResilienceConfiguration.CircuitBreakerConfiguration slowCallRateThreshold(float slowCallRateThreshold)
      The slow call rate threshold (as percentage within [0, 100]). The CircuitBreaker considers a call as slow when the call duration is greater than slowCallDurationThreshold. When the percentage of slow calls is equal to or greater than the threshold, the CircuitBreaker transitions to OPEN and starts short-circuiting calls.
      Returns:
      this.
      Since:
      5.29.0