[incubator-dubbo] branch master updated: #2188 ConsistentHashLoadBalance selectForKey can optimization (#2190)
This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git The following commit(s) were added to refs/heads/master by this push: new 6ebc183 #2188 ConsistentHashLoadBalance selectForKey can optimization (#2190) 6ebc183 is described below commit 6ebc183173eef83d77208ae8a7f1cda2ccf3b977 Author: huangyunbin <395018...@qq.com> AuthorDate: Mon Aug 6 15:41:14 2018 +0800 #2188 ConsistentHashLoadBalance selectForKey can optimization (#2190) --- .../apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java index 31749b2..8671cde 100644 --- a/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java +++ b/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java @@ -103,7 +103,7 @@ public class ConsistentHashLoadBalance extends AbstractLoadBalance { } private Invoker selectForKey(long hash) { -Map.Entry> entry = virtualInvokers.tailMap(hash, true).firstEntry(); +Map.Entry> entry = virtualInvokers.ceilingEntry(hash); if (entry == null) { entry = virtualInvokers.firstEntry(); }
[incubator-dubbo] branch 2.6.x updated: fix ut unstable (#2192)
This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch 2.6.x in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git The following commit(s) were added to refs/heads/2.6.x by this push: new 7884aec fix ut unstable (#2192) 7884aec is described below commit 7884aec202238aecdb91c60722b6baaedcf1d9d7 Author: Jerrick Zhu AuthorDate: Mon Aug 6 18:10:24 2018 +0800 fix ut unstable (#2192) --- .../src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java index 5366b90..765c429 100644 --- a/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java +++ b/dubbo-config/dubbo-config-api/src/test/java/com/alibaba/dubbo/config/AbstractConfigTest.java @@ -21,6 +21,7 @@ import com.alibaba.dubbo.common.utils.ConfigUtils; import com.alibaba.dubbo.config.api.Greeting; import com.alibaba.dubbo.config.support.Parameter; import junit.framework.TestCase; +import org.hamcrest.Matchers; import org.junit.Test; import java.lang.annotation.ElementType; @@ -32,6 +33,8 @@ import java.util.HashMap; import java.util.Map; import java.util.Properties; +import static org.junit.Assert.assertThat; + public class AbstractConfigTest { @Test @@ -267,8 +270,8 @@ public class AbstractConfigTest { TestCase.assertEquals(2, annotationConfig.getParameters().size()); TestCase.assertEquals("v1", annotationConfig.getParameters().get("k1")); TestCase.assertEquals("v2", annotationConfig.getParameters().get("k2")); -TestCase.assertEquals("", -annotationConfig.toString()); +assertThat(annotationConfig.toString(), Matchers.containsString("filter=\"f1, f2\" ")); +assertThat(annotationConfig.toString(), Matchers.containsString("listener=\"l1, l2\" ")); } private static class PropertiesConfig extends AbstractConfig {
[incubator-dubbo] branch master updated: 解析用户定义的URL时,当前太过粗暴,做下优雅调整 (#2077)
This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git The following commit(s) were added to refs/heads/master by this push: new 547947a 解析用户定义的URL时,当前太过粗暴,做下优雅调整 (#2077) 547947a is described below commit 547947a85719ec11eb43ee23773349c5f30ace27 Author: 王虹凯 AuthorDate: Tue Aug 7 10:31:56 2018 +0800 解析用户定义的URL时,当前太过粗暴,做下优雅调整 (#2077) --- .../src/main/java/org/apache/dubbo/common/utils/UrlUtils.java | 11 --- .../test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java | 6 ++ 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java index 408cac7..a7b3301 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/utils/UrlUtils.java @@ -27,12 +27,17 @@ import java.util.Set; public class UrlUtils { +/** + * in the url string,mark the param begin + */ +private final static String URL_PARAM_STARTING_SYMBOL = "?"; + public static URL parseURL(String address, Map defaults) { if (address == null || address.length() == 0) { return null; } String url; -if (address.indexOf("://") >= 0) { +if (address.contains("://") || address.contains(URL_PARAM_STARTING_SYMBOL)) { url = address; } else { String[] addresses = Constants.COMMA_SPLIT_PATTERN.split(address); @@ -45,7 +50,7 @@ public class UrlUtils { } backup.append(addresses[i]); } -url += "?" + Constants.BACKUP_KEY + "=" + backup.toString(); +url += URL_PARAM_STARTING_SYMBOL + Constants.BACKUP_KEY + "=" + backup.toString(); } } String defaultProtocol = defaults == null ? null : defaults.get("protocol"); @@ -335,7 +340,7 @@ public class UrlUtils { version = service.substring(i + 1); service = service.substring(0, i); } -return URL.valueOf(Constants.EMPTY_PROTOCOL + "://0.0.0.0/" + service + "?" +return URL.valueOf(Constants.EMPTY_PROTOCOL + "://0.0.0.0/" + service + URL_PARAM_STARTING_SYMBOL + Constants.CATEGORY_KEY + "=" + category + (group == null ? "" : "&" + Constants.GROUP_KEY + "=" + group) + (version == null ? "" : "&" + Constants.VERSION_KEY + "=" + version)); diff --git a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java index bdb2a9d..7141c96 100644 --- a/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java +++ b/dubbo-common/src/test/java/org/apache/dubbo/common/utils/UrlUtilsTest.java @@ -57,6 +57,12 @@ public class UrlUtilsTest { } @Test +public void testParseURLWithSpecial() { +String address = "127.0.0.1:2181?backup=127.0.0.1:2182,127.0.0.1:2183"; +assertEquals("dubbo://" + address,UrlUtils.parseURL(address, null).toString()); +} + +@Test public void testDefaultUrl() { String address = "127.0.0.1"; URL url = UrlUtils.parseURL(address, null);
[incubator-dubbo] branch master updated: deprecated unused method for Activate #2180 (#2193)
This is an automated email from the ASF dual-hosted git repository. jerrick pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-dubbo.git The following commit(s) were added to refs/heads/master by this push: new e961c90 deprecated unused method for Activate #2180 (#2193) e961c90 is described below commit e961c9018299afe072fa380f65320d5bd812822c Author: Jerrick Zhu AuthorDate: Tue Aug 7 10:34:51 2018 +0800 deprecated unused method for Activate #2180 (#2193) --- .../src/main/java/com/alibaba/dubbo/common/extension/Activate.java| 2 ++ .../src/main/java/org/apache/dubbo/common/extension/Activate.java | 4 2 files changed, 6 insertions(+) diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.java index 02b78bc..9aecbce 100644 --- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.java +++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/extension/Activate.java @@ -35,8 +35,10 @@ public @interface Activate { String[] value() default {}; +@Deprecated String[] before() default {}; +@Deprecated String[] after() default {}; int order() default 0; diff --git a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/Activate.java b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/Activate.java index 52e9305..ba1873e 100644 --- a/dubbo-common/src/main/java/org/apache/dubbo/common/extension/Activate.java +++ b/dubbo-common/src/main/java/org/apache/dubbo/common/extension/Activate.java @@ -67,16 +67,20 @@ public @interface Activate { /** * Relative ordering info, optional + * Deprecated since 2.7.0 * * @return extension list which should be put before the current one */ +@Deprecated String[] before() default {}; /** * Relative ordering info, optional + * Deprecated since 2.7.0 * * @return extension list which should be put after the current one */ +@Deprecated String[] after() default {}; /**