Package io.github.resilience4j.bulkhead
Class BulkheadConfig.Builder
java.lang.Object
io.github.resilience4j.bulkhead.BulkheadConfig.Builder
- Enclosing class:
- BulkheadConfig
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds a BulkheadConfigfairCallHandlingStrategyEnabled(boolean fairCallHandlingEnabled) Indicates whether FairSync or NonfairSync should be used in Semaphore.maxConcurrentCalls(int maxConcurrentCalls) Configures the max amount of concurrent calls the bulkhead will support.maxWaitDuration(Duration maxWaitDuration) Configures a maximum amount of time which the calling thread will wait to enter the bulkhead.writableStackTraceEnabled(boolean writableStackTraceEnabled) Enables writable stack traces.
-
Constructor Details
-
Builder
public Builder() -
Builder
-
-
Method Details
-
maxConcurrentCalls
Configures the max amount of concurrent calls the bulkhead will support.- Parameters:
maxConcurrentCalls- max concurrent calls- Returns:
- the BulkheadConfig.Builder
-
maxWaitDuration
Configures a maximum amount of time which the calling thread will wait to enter the bulkhead. If bulkhead has space available, entry is guaranteed and immediate. If bulkhead is full, calling threads will contest for space, if it becomes available. maxWaitDuration can be set to 0.Note: for threads running on an event-loop or equivalent (rx computation pool, etc), setting maxWaitDuration to 0 is highly recommended. Blocking an event-loop thread will most likely have a negative effect on application throughput.
- Parameters:
maxWaitDuration- maximum wait time for bulkhead entry- Returns:
- the BulkheadConfig.Builder
-
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
-
fairCallHandlingStrategyEnabled
Indicates whether FairSync or NonfairSync should be used in Semaphore. When set to true, a fair call handling strategy is used. It guarantees the order of incoming requests (FIFO) based on internal queue. When set to false, an non fair strategy will be used which does not guarantee any order of calls.- Parameters:
fairCallHandlingEnabled- flag to choose call handling strategy between fair and unfair- Returns:
- the BulkheadConfig.Builder
-
build
Builds a BulkheadConfig- Returns:
- the BulkheadConfig
-