Skip to content

Commit a144d28

Browse files
committedJun 1, 2018
Merge #1740 manually, fix typo.
1 parent f4c210b commit a144d28

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed
 

‎dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/configurator/AbstractConfigurator.java

+8-14
Original file line numberDiff line numberDiff line change
@@ -79,23 +79,23 @@ private URL configureIfMatch(String host, URL url) {
7979
String currentApplication = url.getParameter(Constants.APPLICATION_KEY, url.getUsername());
8080
if (configApplication == null || Constants.ANY_VALUE.equals(configApplication)
8181
|| configApplication.equals(currentApplication)) {
82-
Set<String> condtionKeys = new HashSet<String>();
83-
condtionKeys.add(Constants.CATEGORY_KEY);
84-
condtionKeys.add(Constants.CHECK_KEY);
85-
condtionKeys.add(Constants.DYNAMIC_KEY);
86-
condtionKeys.add(Constants.ENABLED_KEY);
82+
Set<String> conditionKeys = new HashSet<String>();
83+
conditionKeys.add(Constants.CATEGORY_KEY);
84+
conditionKeys.add(Constants.CHECK_KEY);
85+
conditionKeys.add(Constants.DYNAMIC_KEY);
86+
conditionKeys.add(Constants.ENABLED_KEY);
8787
for (Map.Entry<String, String> entry : configuratorUrl.getParameters().entrySet()) {
8888
String key = entry.getKey();
8989
String value = entry.getValue();
9090
if (key.startsWith("~") || Constants.APPLICATION_KEY.equals(key) || Constants.SIDE_KEY.equals(key)) {
91-
condtionKeys.add(key);
91+
conditionKeys.add(key);
9292
if (value != null && !Constants.ANY_VALUE.equals(value)
9393
&& !value.equals(url.getParameter(key.startsWith("~") ? key.substring(1) : key))) {
9494
return url;
9595
}
9696
}
9797
}
98-
return doConfigure(url, configuratorUrl.removeParameters(condtionKeys));
98+
return doConfigure(url, configuratorUrl.removeParameters(conditionKeys));
9999
}
100100
}
101101
return url;
@@ -119,13 +119,7 @@ public int compareTo(Configurator o) {
119119
if (ipCompare == 0) {//host is the same, sort by priority
120120
int i = getUrl().getParameter(Constants.PRIORITY_KEY, 0),
121121
j = o.getUrl().getParameter(Constants.PRIORITY_KEY, 0);
122-
if (i < j) {
123-
return -1;
124-
} else if (i > j) {
125-
return 1;
126-
} else {
127-
return 0;
128-
}
122+
return i < j ? -1 : (i == j ? 0 : 1);
129123
} else {
130124
return ipCompare;
131125
}

0 commit comments

Comments
 (0)
Please sign in to comment.