fix:fix NPE. (#885)

pull/889/head
Haotian Zhang 2 years ago committed by GitHub
parent 4639a765e7
commit 1e2f01b28b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -13,3 +13,4 @@
- [optimize:optimize ServiceRuleManager.](https://github.com/Tencent/spring-cloud-tencent/pull/878)
- [refactor:refactor stat module.](https://github.com/Tencent/spring-cloud-tencent/pull/879)
- [feature:add polaris circuit breaker support.](https://github.com/Tencent/spring-cloud-tencent/pull/881)
- [fix:fix NPE.](https://github.com/Tencent/spring-cloud-tencent/pull/885)

@ -18,12 +18,11 @@
package com.tencent.cloud.rpc.enhancement.feign;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Multimap;
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignContext;
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPlugin;
import com.tencent.cloud.rpc.enhancement.feign.plugin.EnhancedFeignPluginType;
@ -37,18 +36,13 @@ import org.springframework.util.CollectionUtils;
*/
public class DefaultEnhancedFeignPluginRunner implements EnhancedFeignPluginRunner {
private Map<String, List<EnhancedFeignPlugin>> pluginMap = new HashMap<>();
private final Multimap<String, EnhancedFeignPlugin> pluginMap = ArrayListMultimap.create();
public DefaultEnhancedFeignPluginRunner(List<EnhancedFeignPlugin> enhancedFeignPlugins) {
if (!CollectionUtils.isEmpty(enhancedFeignPlugins)) {
enhancedFeignPlugins.stream()
.sorted(Comparator.comparing(EnhancedFeignPlugin::getOrder))
.forEach(plugin -> {
if (!pluginMap.containsKey(plugin.getType().name())) {
pluginMap.put(plugin.getType().name(), new ArrayList<>());
}
pluginMap.get(plugin.getType().name()).add(plugin);
});
.forEach(plugin -> pluginMap.put(plugin.getType().name(), plugin));
}
}

Loading…
Cancel
Save