Skip to content

Commit

Permalink
Fix shared BulkheadRegistry
Browse files Browse the repository at this point in the history
  • Loading branch information
hexiaofeng committed Jan 5, 2025
1 parent 77bde45 commit b048cc1
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@
*/
public class Resilience4jConcurrencyLimiter extends AbstractConcurrencyLimiter {

private static final BulkheadRegistry REGISTRY = BulkheadRegistry.ofDefaults();

private final Bulkhead bulkhead;

public Resilience4jConcurrencyLimiter(ConcurrencyLimitPolicy policy) {
Expand All @@ -39,8 +41,7 @@ public Resilience4jConcurrencyLimiter(ConcurrencyLimitPolicy policy) {
.maxConcurrentCalls(policy.getMaxConcurrency() == null ? 0 : policy.getMaxConcurrency())
.maxWaitDuration(Duration.ofMillis(policy.getMaxWaitMs() == null || policy.getMaxWaitMs() < 0 ? 0 : policy.getMaxWaitMs()))
.build();
BulkheadRegistry registry = BulkheadRegistry.of(config);
bulkhead = registry.bulkhead(policy.getName());
bulkhead = REGISTRY.bulkhead(policy.getName(), config);
}

@Override
Expand Down

0 comments on commit b048cc1

Please sign in to comment.