Package io.github.resilience4j.bulkhead
Class ThreadPoolBulkheadConfig.Builder
- java.lang.Object
-
- io.github.resilience4j.bulkhead.ThreadPoolBulkheadConfig.Builder
-
- Enclosing class:
- ThreadPoolBulkheadConfig
public static class ThreadPoolBulkheadConfig.Builder extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description Builder()Builder(ThreadPoolBulkheadConfig bulkheadConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ThreadPoolBulkheadConfigbuild()Builds a BulkheadConfigThreadPoolBulkheadConfig.BuildercontextPropagator(io.github.resilience4j.core.ContextPropagator... contextPropagators)ThreadPoolBulkheadConfig.BuildercontextPropagator(java.lang.Class<? extends io.github.resilience4j.core.ContextPropagator>... contextPropagatorClasses)Configures the context propagator class.ThreadPoolBulkheadConfig.BuildercoreThreadPoolSize(int coreThreadPoolSize)Configures the core thread pool size.ThreadPoolBulkheadConfig.BuilderkeepAliveDuration(java.time.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.ThreadPoolBulkheadConfig.BuildermaxThreadPoolSize(int maxThreadPoolSize)Configures the max thread pool size.ThreadPoolBulkheadConfig.BuilderqueueCapacity(int queueCapacity)Configures the capacity of the queue.ThreadPoolBulkheadConfig.BuilderrejectedExecutionHandler(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)Replaces the defaultThreadPoolExecutor.AbortPolicywith theRejectedExecutionHandlerprovided.ThreadPoolBulkheadConfig.BuilderwritableStackTraceEnabled(boolean writableStackTraceEnabled)Enables writable stack traces.
-
-
-
Constructor Detail
-
Builder
public Builder(ThreadPoolBulkheadConfig bulkheadConfig)
-
Builder
public Builder()
-
-
Method Detail
-
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 java.lang.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.- Parameters:
queueCapacity- max concurrent calls- Returns:
- the BulkheadConfig.Builder
-
keepAliveDuration
public ThreadPoolBulkheadConfig.Builder keepAliveDuration(java.time.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(java.util.concurrent.RejectedExecutionHandler rejectedExecutionHandler)
Replaces the defaultThreadPoolExecutor.AbortPolicywith theRejectedExecutionHandlerprovided.- Parameters:
rejectedExecutionHandler- handler to use for rejection of execution.- Returns:
- the BulkheadConfig.Builder
-
build
public ThreadPoolBulkheadConfig build()
Builds a BulkheadConfig- Returns:
- the BulkheadConfig
-
-