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.
  • 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.
    • 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.