You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "chickenlj (GitHub)" <gi...@apache.org> on 2019/01/15 09:51:05 UTC
[GitHub] [incubator-dubbo] chickenlj commented on pull request #3233:
[Dubbo-3231]keep TagRouter consistent with 2.6.x
Yes, I think you are right about the implementation in 2.6.x.
But the difference here is 2.6.x does not have a deliberately defined `force` property, we can also think as it has a `force` key which is always `false`. So in 2.6.x, it will always go to the following branch at
https://github.com/apache/incubator-dubbo/pull/3065/files#diff-179f8c2f0653380f5fd6240f6ce165b7R71
```java
f (result.isEmpty()) {
// Only forceTag = true force match, otherwise downgrade
String forceTag = RpcContext.getContext().getAttachment(Constants.FORCE_USE_TAG);
if (StringUtils.isEmpty(forceTag) || "false".equals(forceTag)) {
for (Invoker<T> invoker : invokers) {
if (StringUtils.isEmpty(invoker.getUrl().getParameter(Constants.TAG_KEY))) {
result.add(invoker);
}
}
}
}
```
irrespective of whether tag present or not.
For 2.7, you can see that we have covered the branch in which tag is not present.
```java
else {
result = filterInvoker(invokers, invoker -> StringUtils.isEmpty(invoker.getUrl().getParameter(Constants.TAG_KEY)));
}
```
But when the tag is empty, I think there's no need to check force, `force=true` only makes sense to the scenario when the tag is not empty.
[ Full content available at: https://github.com/apache/incubator-dubbo/pull/3233 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org