Skip to content

Commit

Permalink
Merge pull request #22286 from geoand/#22281
Browse files Browse the repository at this point in the history
Fix concurrency issue with REST Client Config
  • Loading branch information
michalszynkiewicz committed Dec 17, 2021
2 parents 36ede47 + f308aeb commit dd78341
Showing 1 changed file with 3 additions and 5 deletions.
@@ -1,10 +1,8 @@
package io.quarkus.restclient.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Optional;

import org.wildfly.common.annotation.NotNull;
import java.util.concurrent.ConcurrentHashMap;

import io.quarkus.runtime.annotations.ConfigItem;
import io.quarkus.runtime.annotations.ConfigPhase;
Expand All @@ -29,7 +27,7 @@ public class RestClientsConfig {
// The @Deprecated annotation prevents this field from being included in generated docs. We only want the `configKey` field
// above to be included.
@Deprecated
private final Map<String, RestClientConfig> configs = new HashMap<>();
private final Map<String, RestClientConfig> configs = new ConcurrentHashMap<>();

/**
* By default, REST Client Reactive uses text/plain content type for String values
Expand Down Expand Up @@ -65,7 +63,7 @@ public RestClientConfig getClientConfig(String configKey) {
return configs.computeIfAbsent(configKey, RestClientConfig::load);
}

public RestClientConfig getClientConfig(@NotNull Class<?> clientInterface) {
public RestClientConfig getClientConfig(Class<?> clientInterface) {
return configs.computeIfAbsent(clientInterface.getName(), name -> RestClientConfig.load(clientInterface));
}

Expand Down

0 comments on commit dd78341

Please sign in to comment.