Skip to content
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

fix parsing multi directurl #78

Merged
merged 1 commit into from
May 27, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ private List<URL> parseDirectUrls(String directUrlStr) {
String[] durlArr = MotanConstants.COMMA_SPLIT_PATTERN.split(directUrlStr);
List<URL> directUrls = new ArrayList<URL>();
for (String dus : durlArr) {
URL du = URL.valueOf(dus);
URL du = URL.valueOf(StringTools.urlDecode(dus));
if (du != null) {
directUrls.add(du);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ private ClusterSupport<T> createClusterSupport(URL refUrl, ConfigHandler configH
durl.setHost(hostPort[0].trim());
durl.setPort(Integer.parseInt(hostPort[1].trim()));
durl.addParameter(URLParamType.nodeType.getName(), MotanConstants.NODE_TYPE_SERVICE);
duBuf.append(StringTools.urlDecode(durl.toFullStr())).append(MotanConstants.COMMA_SEPARATOR);
duBuf.append(StringTools.urlEncode(durl.toFullStr())).append(MotanConstants.COMMA_SEPARATOR);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这里相当于以前会进行一次decode,现在会进行一次encode,一次decode,是否有可能出现以前正常,更新后少decode一次的情况?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这个地方的encode、decode只在directurl方式下起作用,并且只在localregistry中保存,更新代码后不会出现问题

}
}
if (duBuf.length() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ private <T> Referer<T> decorateWithFilter(Referer<T> referer, URL url) {
lastRef = new Referer<T>() {
@Override
public Response call(Request request) {
if (!f.getClass().getAnnotation(Activation.class).retry() && request.getRetries() != 0) {
Activation activation = f.getClass().getAnnotation(Activation.class);
if (activation != null && !activation.retry() && request.getRetries() != 0) {
return lf.call(request);
}
return f.filter(lf, request);
Expand Down