Class ThreadPoolBulkheadConfig.Builder

java.lang.Object
io.github.resilience4j.bulkhead.ThreadPoolBulkheadConfig.Builder
Enclosing class:
ThreadPoolBulkheadConfig

public static class ThreadPoolBulkheadConfig.Builder extends Object
  • Constructor Details

  • Method Details

    • maxThreadPoolSize

      public ThreadPoolBulkheadConfig.Builder maxThreadPoolSize(int maxThreadPoolSize)
      Configures the max thread pool size.
      Parameters:
      maxThreadPoolSize - max thread pool size
      Returns:
      the BulkheadConfig.Builder
    • coreThreadPoolSize

      public ThreadPoolBulkheadConfig.Builder coreThreadPoolSize(int coreThreadPoolSize)
      Configures the core thread pool size.
      Parameters:
      coreThreadPoolSize - core thread pool size
      Returns:
      the BulkheadConfig.Builder
    • contextPropagator

      public final ThreadPoolBulkheadConfig.Builder contextPropagator(@Nullable Class<? extends io.github.resilience4j.core.ContextPropagator>... contextPropagatorClasses)
      Configures the context propagator class.
      Returns:
      the BulkheadConfig.Builder
    • contextPropagator

      public final ThreadPoolBulkheadConfig.Builder contextPropagator(io.github.resilience4j.core.ContextPropagator... contextPropagators)
    • queueCapacity

      public ThreadPoolBulkheadConfig.Builder queueCapacity(int queueCapacity)
      Configures the capacity of the queue. Use SynchronousQueue when queueCapacity == 0 or ArrayBlockingQueue when queueCapacity > 0.
      Parameters:
      queueCapacity - max concurrent calls
      Returns:
      the BulkheadConfig.Builder
    • keepAliveDuration

      public ThreadPoolBulkheadConfig.Builder keepAliveDuration(Duration keepAliveDuration)
      When the number of threads is greater than the core, this is the maximum time duration that excess idle threads will wait for new tasks before terminating.
      Parameters:
      keepAliveDuration - maximum wait duration for bulkhead thread pool idle thread
      Returns:
      the BulkheadConfig.Builder
    • writableStackTraceEnabled

      public ThreadPoolBulkheadConfig.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
    • rejectedExecutionHandler

      public ThreadPoolBulkheadConfig.Builder rejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
      Replaces the default ThreadPoolExecutor.AbortPolicy with the RejectedExecutionHandler provided.
      Parameters:
      rejectedExecutionHandler - handler to use for rejection of execution.
      Returns:
      the BulkheadConfig.Builder
    • build

      public ThreadPoolBulkheadConfig build()
      Builds a BulkheadConfig
      Returns:
      the BulkheadConfig