Class CircuitBreakerConfig.Builder

    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • enabled

        public CircuitBreakerConfig.Builder enabled​(boolean enabled)
        Enables or disables this circuit breaker.

        If this property is set to false, then all other properties are not looked at.

        Parameters:
        enabled - if true enables it, if false disables it.
        Returns:
        this CircuitBreakerConfig.Builder for chaining purposes.
      • volumeThreshold

        public CircuitBreakerConfig.Builder volumeThreshold​(int volumeThreshold)
        The volume threshold defines how many operations need to be in the window at least so that the threshold percentage can be meaningfully calculated.

        The default is 20.

        Parameters:
        volumeThreshold - the volume threshold in the interval.
        Returns:
        this CircuitBreakerConfig.Builder for chaining purposes.
      • errorThresholdPercentage

        public CircuitBreakerConfig.Builder errorThresholdPercentage​(int errorThresholdPercentage)
        The percentage of operations that need to fail in a window until the circuit is opened.

        The default is 50.

        Parameters:
        errorThresholdPercentage - the percent of ops that need to fail.
        Returns:
        this CircuitBreakerConfig.Builder for chaining purposes.
      • sleepWindow

        public CircuitBreakerConfig.Builder sleepWindow​(Duration sleepWindow)
        The sleep window that is waited from when the circuit opens to when the canary is tried.

        The default is 5 seconds.

        Parameters:
        sleepWindow - the sleep window as a duration.
        Returns:
        this CircuitBreakerConfig.Builder for chaining purposes.
      • rollingWindow

        public CircuitBreakerConfig.Builder rollingWindow​(Duration rollingWindow)
        How long the window is in which the number of failed ops are tracked in a rolling fashion.

        The default is 1 minute.

        Parameters:
        rollingWindow - the rolling window duration.
        Returns:
        this CircuitBreakerConfig.Builder for chaining purposes.