Class BulkheadConfig.Builder

java.lang.Object
com.shri.restinpeace.BulkheadConfig.Builder
Enclosing class:
BulkheadConfig

public static final class BulkheadConfig.Builder extends Object
Builds a BulkheadConfig.
  • Method Details

    • maxConcurrentCalls

      public BulkheadConfig.Builder maxConcurrentCalls(int maxConcurrentCalls)
      Sets the concurrency cap.
      Parameters:
      maxConcurrentCalls - the maximum number of calls to this client permitted in flight at once; must be at least 1
      Returns:
      this builder
    • maxWaitDuration

      public BulkheadConfig.Builder maxWaitDuration(Duration maxWaitDuration)
      Sets how long a call waits for a free permit before being refused with a BulkheadFullException - a queueing tolerance for a bursty caller (see the high-fan-out async persona in the design doc) rather than the fail-fast default, where every permit already being held immediately refuses the call.
      Parameters:
      maxWaitDuration - the maximum wait for a permit; Duration.ZERO (the default) fails immediately instead of waiting at all; must not be negative
      Returns:
      this builder
    • build

      public BulkheadConfig build()
      Builds the config.
      Returns:
      the built config