You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "cvictory (GitHub)" <gi...@apache.org> on 2019/01/16 07:48:29 UTC

[GitHub] [incubator-dubbo] cvictory opened issue #3249: Dubbo route compareTo method donot work correctly

有如下问题:
1.java中要求 A.compareTo(B)和B.compareTo(A)得到的结果,应该是等价的。但是ScriptRoute里
```
` @Override
    public int compareTo(Router o) {
        if (o == null || o.getClass() != ScriptRouter.class) {
            return 1;
        }
        ScriptRouter c = (ScriptRouter) o;
        return this.priority == c.priority ? rule.compareTo(c.rule) : (this.priority > c.priority ? 1 : -1);
    }
```
想让ScriptRoute.compareTo(others) 等价于  others.compareTo(scriptRoute),  其实部分其他script如果自定义了自己的compareTo也会存在这个问题。

2. 2.6和2.7兼容的问题
2.6和2.7的顺序要怎么满足合理需求的同时,同时能满足前面的第一点要求。

先做个记录,问题待细化。

---------transplate

Have the following questions:
1.java requires that the results obtained by A.compareTo(B) and B.compareTo(A) should be equivalent. But in ScriptRoute
```
` @Override
     Public int compareTo(Router o) {
         If (o == null || o.getClass() != ScriptRouter.class) {
             Return 1;
         }
         ScriptRouter c = (ScriptRouter) o;
         Return this.priority == c.priority ? rule.compareTo(c.rule) : (this.priority > c.priority ? 1 : -1);
     }
```
let ScriptRoute.compareTo(others) to be equivalent to others.compareTo(scriptRoute). In fact, some other scripts have this problem if they customize their compareTo.

2. 2.6 and 2.7 compatible issues
How the order of 2.6 and 2.7 can meet the reasonable requirements, while meeting the first point requirements.


Make a record first, and the problem is to be refined.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3249 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] beiwei30 commented on issue #3249: Dubbo route compareTo method donot work correctly

Posted by "beiwei30 (GitHub)" <gi...@apache.org>.
@cvictory is this fixed on both 2.7 and 2.6?

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3249 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] lexburner commented on issue #3249: Dubbo route compareTo method donot work correctly

Posted by "lexburner (GitHub)" <gi...@apache.org>.
I have submitted the pr to fix this problem on both  2.7 and 2.6. The method `compareTo` is no need to  
 overwrite in the most cases since the method `getPriority` existing.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3249 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] carryxyh commented on issue #3249: Dubbo route compareTo method donot work correctly

Posted by "carryxyh (GitHub)" <gi...@apache.org>.
第一个问题在master上已经修复了,那位提交者没有提交到2.6.x分支上,可以艾特他再提交一个到2.6.x上好了

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3249 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] lexburner commented on issue #3249: Dubbo route compareTo method donot work correctly

Posted by "lexburner (GitHub)" <gi...@apache.org>.
I have submitted the pr to fix this problem on both  2.7 and 2.6. The method `compareTo` is no need to  
 overwrite in the most case since the method `getPriority` existing.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3249 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org