Skip to content

Why use thread pool isolation as the default isolation method? #119

@suanyi001

Description

@suanyi001

Problem describe.
I uesed spring-cloud-starter-circuitbreaker-resilience4j:2020.0.3 and resilience4j-bulkhead in my project dependencies, When I read the source code, I found the following code in org.springframework.cloud.circuitbreaker.resilience4j.Resilience4jBulkheadProvider:

   private <T> Supplier<CompletionStage<T>> decorateBulkhead(final String id, final Map<String, String> tags, final Supplier<T> supplier) {
        BulkheadConfiguration configuration = (BulkheadConfiguration)this.configurations.computeIfAbsent(id, this.defaultConfiguration);
        if (this.bulkheadRegistry.find(id).isPresent() && !this.threadPoolBulkheadRegistry.find(id).isPresent()) {
            Bulkhead bulkhead = this.bulkheadRegistry.bulkhead(id, configuration.getBulkheadConfig(), tags);
            CompletableFuture<T> asyncCall = CompletableFuture.supplyAsync(supplier);
            return Bulkhead.decorateCompletionStage(bulkhead, () -> {
                return asyncCall;
            });
        } else {
            ThreadPoolBulkhead threadPoolBulkhead = this.threadPoolBulkheadRegistry.bulkhead(id, configuration.getThreadPoolBulkheadConfig(), tags);
            return threadPoolBulkhead.decorateSupplier(supplier);
        }
    }

it makes Thread-pool isolation as the default isolation.And I did not find that semaphore isolation can be configured globally as the default isolation method. Can you provide a way like this.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or requesthelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions