Skip to content

Commit

Permalink
Remove redundant 'get' action after 'computeIFAbsent', (#8260)
Browse files Browse the repository at this point in the history
Co-authored-by: Annoyer <247221925@qq.com>
  • Loading branch information
JasmineJ1230 and Annoyer authored Jul 11, 2021
1 parent a4dcaf4 commit c41362b
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,16 +107,13 @@ public <T> T get(ReferenceConfigBase<T> referenceConfig) {
String key = generator.generateKey(referenceConfig);
Class<?> type = referenceConfig.getInterfaceClass();

proxies.computeIfAbsent(type, _t -> new ConcurrentHashMap<>());
ConcurrentMap<String, Object> proxiesOfType = proxies.computeIfAbsent(type, _t -> new ConcurrentHashMap<>());

ConcurrentMap<String, Object> proxiesOfType = proxies.get(type);
proxiesOfType.computeIfAbsent(key, _k -> {
return (T) proxiesOfType.computeIfAbsent(key, _k -> {
Object proxy = referenceConfig.get();
referredReferences.put(key, referenceConfig);
return proxy;
});

return (T) proxiesOfType.get(key);
}

/**
Expand Down

0 comments on commit c41362b

Please sign in to comment.