Class RateLimiterConfig.Builder

  • Enclosing class:
    RateLimiterConfig

    public static class RateLimiterConfig.Builder
    extends java.lang.Object
    • Constructor Detail

      • Builder

        public Builder()
    • Method Detail

      • build

        public RateLimiterConfig build()
        Builds a RateLimiterConfig
        Returns:
        the RateLimiterConfig
      • writableStackTraceEnabled

        public RateLimiterConfig.Builder writableStackTraceEnabled​(boolean writableStackTraceEnabled)
        Enables writable stack traces. When set to false, Throwable.getStackTrace() returns a zero length array. This may be used to reduce log spam when the circuit breaker is open as the cause of the exceptions is already known (the circuit breaker is short-circuiting calls).
        Parameters:
        writableStackTraceEnabled - flag to control if stack trace is writable
        Returns:
        the BulkheadConfig.Builder
      • timeoutDuration

        public RateLimiterConfig.Builder timeoutDuration​(java.time.Duration timeoutDuration)
        Configures the default wait for permission duration. Default value is 5 seconds.
        Parameters:
        timeoutDuration - the default wait for permission duration
        Returns:
        the RateLimiterConfig.Builder
      • limitRefreshPeriod

        public RateLimiterConfig.Builder limitRefreshPeriod​(java.time.Duration limitRefreshPeriod)
        Configures the period of limit refresh. After each period rate limiter sets its permissions count to RateLimiterConfig.limitForPeriod value. Default value is 500 nanoseconds.
        Parameters:
        limitRefreshPeriod - the period of limit refresh
        Returns:
        the RateLimiterConfig.Builder
      • limitForPeriod

        public RateLimiterConfig.Builder limitForPeriod​(int limitForPeriod)
        Configures the permissions limit for refresh period. Count of permissions available during one rate limiter period specified by RateLimiterConfig.limitRefreshPeriod value. Default value is 50.
        Parameters:
        limitForPeriod - the permissions limit for refresh period
        Returns:
        the RateLimiterConfig.Builder