-
Notifications
You must be signed in to change notification settings - Fork 26.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Dubbo-#1293][Baiji-9]fix the issue #1293 #2357
Conversation
@@ -149,5 +202,6 @@ public String toString() { | |||
|
|||
public static interface KeyGenerator { | |||
String generateKey(ReferenceConfig<?> referenceConfig); | |||
String generateKey(String version,String url,String name); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the parameters are version, url and name? not interfaceName, group and version?
}; | ||
static final ConcurrentMap<String, ReferenceConfigCache> cacheHolder = new ConcurrentHashMap<String, ReferenceConfigCache>(); | ||
private final String name; | ||
private final KeyGenerator generator; | ||
ConcurrentMap<String, ReferenceConfig<?>> cache = new ConcurrentHashMap<String, ReferenceConfig<?>>(); | ||
|
||
//存储自定以字段到ReferenceConfig的映射 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please use English comments.
@@ -115,12 +130,50 @@ public static ReferenceConfigCache getCache(String name, KeyGenerator keyGenerat | |||
return (T) config.get(); | |||
} | |||
|
|||
public <T> void put(String version,String url,String name,ReferenceConfig<T> referenceConfig){ | |||
if(StringUtils.isBlank(version)){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to format your code, check https://github.com/apache/incubator-dubbo/blob/master/codestyle/dubbo_codestyle_for_idea.xml
Since we have not found a reasonable, easy-to-use way for ReferenceConfigCache, we'll close this PR firstly. |
What is the purpose of the change
fix the issue #1293
Brief changelog
add the method of getting whether the cache exists
add the method of putting key and ReferenceConfig
add a new method of getting ReferenceConfig through url,name,version
Verifying this change
Follow this checklist to help us incorporate your contribution quickly and easily:
[Dubbo-XXX] Fix UnknownException when host config not exist #XXX
. Each commit in the pull request should have a meaningful subject line and body.mvn clean install -DskipTests
&mvn clean test-compile failsafe:integration-test
to make sure unit-test and integration-test pass.