Interface BulkheadProvider


public interface BulkheadProvider
Escape hatch for RipClientConfig.Builder.bulkhead(BulkheadProvider) - delegates the actual admission decision to an already-running bulkhead instance (resilience4j or otherwise) instead of RIP's own built-in BulkheadConfig-driven Semaphore. See docs/design/circuit-breaker-bulkhead.md ยง5 for the full "build-your-own default, pluggable override" reasoning.
 Bulkhead r4jBulkhead = Bulkhead.ofDefaults("payment-api");

 RipClientConfig config = RipClientConfig.builder()
         .bulkhead(new BulkheadProvider() {
             public boolean tryAcquirePermission() {
                 return r4jBulkhead.tryAcquirePermission();
             }
             public void onComplete() {
                 r4jBulkhead.onComplete();
             }
         })
         .build();
 UserApi api = RIP.getClient(UserApi.class, config);
 

Only comes into play when explicitly configured this way - a client configured with BulkheadConfig instead uses RIP's own built-in implementation, unaffected. Setting one clears the other on the builder, the same "last call wins" shape CircuitBreakerConfig.Builder's own overloaded slidingWindowSize setters already use.

Unlike RIP's own BulkheadConfig.getMaxWaitDurationMillis(), tryAcquirePermission() is assumed non-blocking - the same assumption resilience4j's own Bulkhead#tryAcquirePermission() makes - so it's called directly on the caller's thread on both the sync and async dispatch paths, with no background-thread hop.

  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Called once a permitted call completes, successfully or not.
    boolean
    Called before every attempt to ask whether the call should proceed at all.
  • Method Details

    • tryAcquirePermission

      boolean tryAcquirePermission()
      Called before every attempt to ask whether the call should proceed at all.
      Returns:
      true to let the call proceed; false to refuse it immediately with a BulkheadFullException, without ever attempting the network call
    • onComplete

      void onComplete()
      Called once a permitted call completes, successfully or not.