diff --git a/all/pom.xml b/all/pom.xml index bc7b13675..ba240f147 100644 --- a/all/pom.xml +++ b/all/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa sofa-rpc-all - 5.11.0-SNAPSHOT + 5.11.0 ${project.groupId}:${project.artifactId} @@ -57,9 +57,9 @@ utf-8 1.7.21 1.3.2 - 3.28.0-GA + 3.29.2-GA 4.1.44.Final - 3.4.0 + 3.5.0 3.6.3.Final 1.6.6 3.0.8 diff --git a/bom/pom.xml b/bom/pom.xml index 8d75765af..56f3a2de5 100644 --- a/bom/pom.xml +++ b/bom/pom.xml @@ -10,8 +10,8 @@ pom - 5.11.0-SNAPSHOT - 3.28.0-GA + 5.11.0 + 3.29.2-GA 1.9.8 4.1.77.Final @@ -20,9 +20,10 @@ 1.0.2.Final 3.4.10 7.5.4.v20111024 - 4.0.1 + 3.5.7 + 4.3.0 0.22.0 - 2.6.9 + 3.1.8 2.0.3 6.3.0 1.2.2 @@ -31,7 +32,7 @@ 32.0.0-jre 0.16.0 - 3.4.0 + 3.5.0 0.9.2 3.22.0 2.12.7 @@ -300,25 +301,41 @@ org.apache.curator - curator-recipes + curator-framework ${curator.version} + + + org.apache.zookeeper + zookeeper + + org.apache.curator - curator-test + curator-x-discovery ${curator.version} - test - zookeeper org.apache.zookeeper + zookeeper + + + + + org.apache.zookeeper + zookeeper + ${zookeeper.version} + + + io.netty + netty - com.alibaba + org.apache.dubbo dubbo ${dubbo.version} @@ -492,6 +509,18 @@ + + org.apache.curator + curator-test + ${curator.version} + + + org.apache.zookeeper + zookeeper + + + test + junit junit diff --git a/bootstrap/bootstrap-dubbo/pom.xml b/bootstrap/bootstrap-dubbo/pom.xml index 09d8f8865..12645457a 100644 --- a/bootstrap/bootstrap-dubbo/pom.xml +++ b/bootstrap/bootstrap-dubbo/pom.xml @@ -20,7 +20,7 @@ - com.alibaba + org.apache.dubbo dubbo diff --git a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConsumerBootstrap.java b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConsumerBootstrap.java index b86357544..1cc260735 100644 --- a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConsumerBootstrap.java +++ b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConsumerBootstrap.java @@ -16,7 +16,7 @@ */ package com.alipay.sofa.rpc.bootstrap.dubbo; -import com.alibaba.dubbo.config.ReferenceConfig; +import org.apache.dubbo.config.ReferenceConfig; import com.alipay.sofa.rpc.bootstrap.ConsumerBootstrap; import com.alipay.sofa.rpc.client.Cluster; import com.alipay.sofa.rpc.client.ProviderGroup; @@ -100,7 +100,7 @@ private void copyCommon(ConsumerConfig consumerConfig, ReferenceConfig ref private void copyApplication(ConsumerConfig consumerConfig, ReferenceConfig referenceConfig) { ApplicationConfig applicationConfig = consumerConfig.getApplication(); - com.alibaba.dubbo.config.ApplicationConfig dubboConfig = new com.alibaba.dubbo.config.ApplicationConfig(); + org.apache.dubbo.config.ApplicationConfig dubboConfig = new org.apache.dubbo.config.ApplicationConfig(); dubboConfig.setName(applicationConfig.getAppName()); referenceConfig.setApplication(dubboConfig); } @@ -140,11 +140,10 @@ private void copyConsumer(ConsumerConfig consumerConfig, ReferenceConfig r private void copyMethods(ConsumerConfig consumerConfig, ReferenceConfig referenceConfig) { Map methodConfigs = consumerConfig.getMethods(); if (CommonUtils.isNotEmpty(methodConfigs)) { - List dubboMethodConfigs = - new ArrayList(); + List dubboMethodConfigs = new ArrayList<>(); for (Map.Entry entry : methodConfigs.entrySet()) { MethodConfig methodConfig = entry.getValue(); - com.alibaba.dubbo.config.MethodConfig dubboMethodConfig = new com.alibaba.dubbo.config.MethodConfig(); + org.apache.dubbo.config.MethodConfig dubboMethodConfig = new org.apache.dubbo.config.MethodConfig(); dubboMethodConfig.setName(methodConfig.getName()); dubboMethodConfig.setParameters(methodConfig.getParameters()); dubboMethodConfig.setTimeout(methodConfig.getTimeout()); diff --git a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConvertor.java b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConvertor.java index a2f8958c6..4e627c8d9 100644 --- a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConvertor.java +++ b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboConvertor.java @@ -29,19 +29,18 @@ public class DubboConvertor { public static void copyRegistries(com.alipay.sofa.rpc.config.AbstractInterfaceConfig sofaConfig, - com.alibaba.dubbo.config.AbstractInterfaceConfig dubboConfig) { + org.apache.dubbo.config.AbstractInterfaceConfig dubboConfig) { List registryConfigs = sofaConfig.getRegistry(); if (CommonUtils.isNotEmpty(registryConfigs)) { - List dubboRegistryConfigs = - new ArrayList(); + List dubboRegistryConfigs = new ArrayList<>(); for (RegistryConfig registryConfig : registryConfigs) { // 生成并丢到缓存里 - com.alibaba.dubbo.config.RegistryConfig dubboRegistryConfig = DubboSingleton.REGISTRY_MAP + org.apache.dubbo.config.RegistryConfig dubboRegistryConfig = DubboSingleton.REGISTRY_MAP .get(registryConfig); if (dubboRegistryConfig == null) { - dubboRegistryConfig = new com.alibaba.dubbo.config.RegistryConfig(); + dubboRegistryConfig = new org.apache.dubbo.config.RegistryConfig(); copyRegistryFields(registryConfig, dubboRegistryConfig); - com.alibaba.dubbo.config.RegistryConfig old = DubboSingleton.REGISTRY_MAP.putIfAbsent( + org.apache.dubbo.config.RegistryConfig old = DubboSingleton.REGISTRY_MAP.putIfAbsent( registryConfig, dubboRegistryConfig); if (old != null) { dubboRegistryConfig = old; @@ -58,7 +57,7 @@ public static void copyRegistries(com.alipay.sofa.rpc.config.AbstractInterfaceCo } public static void copyRegistryFields(com.alipay.sofa.rpc.config.RegistryConfig sofaRegistryConfig, - com.alibaba.dubbo.config.RegistryConfig dubboRegistryConfig) { + org.apache.dubbo.config.RegistryConfig dubboRegistryConfig) { dubboRegistryConfig.setAddress(sofaRegistryConfig.getAddress()); dubboRegistryConfig.setProtocol(sofaRegistryConfig.getProtocol()); dubboRegistryConfig.setRegister(sofaRegistryConfig.isRegister()); diff --git a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboProviderBootstrap.java b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboProviderBootstrap.java index 0ce91a38a..324b8fff9 100644 --- a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboProviderBootstrap.java +++ b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboProviderBootstrap.java @@ -16,8 +16,8 @@ */ package com.alipay.sofa.rpc.bootstrap.dubbo; -import com.alibaba.dubbo.config.ProtocolConfig; -import com.alibaba.dubbo.config.ServiceConfig; +import org.apache.dubbo.config.ProtocolConfig; +import org.apache.dubbo.config.ServiceConfig; import com.alipay.sofa.rpc.bootstrap.ProviderBootstrap; import com.alipay.sofa.rpc.common.RpcConstants; import com.alipay.sofa.rpc.common.Version; diff --git a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboSingleton.java b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboSingleton.java index 6e1153b44..b3e55b792 100644 --- a/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboSingleton.java +++ b/bootstrap/bootstrap-dubbo/src/main/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboSingleton.java @@ -16,12 +16,12 @@ */ package com.alipay.sofa.rpc.bootstrap.dubbo; -import com.alibaba.dubbo.config.DubboShutdownHook; -import com.alibaba.dubbo.config.ProtocolConfig; +import org.apache.dubbo.config.ProtocolConfig; import com.alipay.sofa.rpc.base.Destroyable; import com.alipay.sofa.rpc.config.RegistryConfig; import com.alipay.sofa.rpc.config.ServerConfig; import com.alipay.sofa.rpc.context.RpcRuntimeContext; +import org.apache.dubbo.rpc.model.FrameworkModel; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -50,17 +50,17 @@ public void postDestroy() { /** * sofa.SeverConfig --> dubbo.ProtocolConfig */ - final static ConcurrentMap SERVER_MAP = new ConcurrentHashMap(); + final static ConcurrentMap SERVER_MAP = new ConcurrentHashMap<>(); /** * sofa.RegistryConfig --> dubbo.RegistryConfig */ - final static ConcurrentMap REGISTRY_MAP = new ConcurrentHashMap(); + final static ConcurrentMap REGISTRY_MAP = new ConcurrentHashMap<>(); /** * Destroy all dubbo resources */ public static void destroyAll() { - DubboShutdownHook.getDubboShutdownHook().destroyAll(); + FrameworkModel.defaultModel().destroy(); } } diff --git a/bootstrap/bootstrap-dubbo/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubooServerTest.java b/bootstrap/bootstrap-dubbo/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubooServerTest.java index 985d7b525..a702ff663 100644 --- a/bootstrap/bootstrap-dubbo/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubooServerTest.java +++ b/bootstrap/bootstrap-dubbo/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubooServerTest.java @@ -17,7 +17,7 @@ package com.alipay.sofa.rpc.bootstrap.dubbo; import com.alibaba.dubbo.common.Constants; -import com.alibaba.dubbo.common.utils.ConfigUtils; +import org.apache.dubbo.common.constants.CommonConstants; import com.alibaba.dubbo.rpc.RpcContext; import com.alibaba.dubbo.rpc.service.GenericService; import com.alipay.sofa.rpc.bootstrap.dubbo.demo.DemoService; @@ -32,6 +32,8 @@ import com.alipay.sofa.rpc.context.RpcInvokeContext; import com.alipay.sofa.rpc.context.RpcRunningState; import com.alipay.sofa.rpc.context.RpcRuntimeContext; +import org.apache.dubbo.config.ConfigKeys; +import org.apache.dubbo.config.context.ConfigMode; import org.junit.After; import org.junit.AfterClass; import org.junit.Assert; @@ -52,10 +54,50 @@ public class DubooServerTest { ConsumerConfig consumerConfig; + private static String OLD_VALUE_SHUTDOWN_WAIT_KEY; + private static String OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE; + private static String OLD_VALUE_DUBBO_CONFIG_MODE; + //dubbo close wait time - @AfterClass + @BeforeClass public static void before() { - ConfigUtils.getProperties().put(Constants.SHUTDOWN_WAIT_KEY, "1"); + RpcRunningState.setUnitTestMode(true); + OLD_VALUE_SHUTDOWN_WAIT_KEY = System.getProperty(CommonConstants.SHUTDOWN_WAIT_KEY); + OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE = System + .getProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE); + OLD_VALUE_DUBBO_CONFIG_MODE = System.getProperty(ConfigKeys.DUBBO_CONFIG_MODE); + + System.setProperty(CommonConstants.SHUTDOWN_WAIT_KEY, "1"); + System.setProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE, "true"); + System.setProperty(ConfigKeys.DUBBO_CONFIG_MODE, ConfigMode.IGNORE.name()); + } + + @AfterClass + public static void after() { + if (OLD_VALUE_SHUTDOWN_WAIT_KEY == null) { + System.clearProperty(CommonConstants.SHUTDOWN_WAIT_KEY); + } else { + System.setProperty(CommonConstants.SHUTDOWN_WAIT_KEY, OLD_VALUE_SHUTDOWN_WAIT_KEY); + } + + if (OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE == null) { + System.clearProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE); + } else { + System.setProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE, + OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE); + } + + if (OLD_VALUE_DUBBO_CONFIG_MODE == null) { + System.clearProperty(ConfigKeys.DUBBO_CONFIG_MODE); + } else { + System.setProperty(ConfigKeys.DUBBO_CONFIG_MODE, OLD_VALUE_DUBBO_CONFIG_MODE); + } + } + + @After + public void afterMethod() { + RpcInternalContext.removeAllContext(); + RpcInvokeContext.removeContext(); } @Test @@ -288,7 +330,7 @@ public void testWithParameterWithVersion() { } } - @Test(expected = com.alibaba.dubbo.rpc.RpcException.class) + @Test(expected = org.apache.dubbo.rpc.RpcException.class) //同步调用,直连,dubbo 消费没有指定dubbo服务版本version public void testConsumerWithNoDubboServiceVersion() { // 只有1个线程 执行 @@ -324,17 +366,4 @@ public void testConsumerWithNoDubboServiceVersion() { Assert.assertTrue(result.equalsIgnoreCase("hello xxx")); } - - @BeforeClass - public static void adBeforeClass() { - RpcRunningState.setUnitTestMode(true); - } - - @After - public void afterMethod() { - DubboSingleton.destroyAll(); - RpcRuntimeContext.destroy(); - RpcInternalContext.removeAllContext(); - RpcInvokeContext.removeContext(); - } } \ No newline at end of file diff --git a/bootstrap/bootstrap-triple/pom.xml b/bootstrap/bootstrap-triple/pom.xml index 2d7e74c00..2eea9c3c2 100644 --- a/bootstrap/bootstrap-triple/pom.xml +++ b/bootstrap/bootstrap-triple/pom.xml @@ -19,7 +19,7 @@ - com.alibaba + org.apache.dubbo dubbo diff --git a/core/api/src/main/java/com/alipay/sofa/rpc/common/Version.java b/core/api/src/main/java/com/alipay/sofa/rpc/common/Version.java index f64663161..a9d42f390 100644 --- a/core/api/src/main/java/com/alipay/sofa/rpc/common/Version.java +++ b/core/api/src/main/java/com/alipay/sofa/rpc/common/Version.java @@ -37,6 +37,6 @@ public final class Version { /** * 当前Build版本,每次发布修改 */ - public static final String BUILD_VERSION = "5.11.0_20230720235253"; + public static final String BUILD_VERSION = "5.11.0_20230828164355"; } diff --git a/example/pom.xml b/example/pom.xml index ca0b3cd87..4cf8c712c 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -108,14 +108,19 @@ - com.alibaba + org.apache.dubbo dubbo org.apache.curator - curator-recipes + curator-framework + test + + + org.apache.curator + curator-x-discovery test diff --git a/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltClientMain.java b/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltClientMain.java index 1568919c5..a4980a3dc 100644 --- a/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltClientMain.java +++ b/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltClientMain.java @@ -43,11 +43,14 @@ public static void main(String[] args) throws InterruptedException { /** * 运行需要pom.xml里增加依赖 - org.apache.curator - curator-recipes + curator-framework test + + org.apache.curator + curator-x-discovery + test */ RegistryConfig registryConfig = new RegistryConfig() .setProtocol(RpcConstants.REGISTRY_PROTOCOL_ZK) diff --git a/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltServerMain.java b/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltServerMain.java index 6eb1335ba..2950c2d29 100644 --- a/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltServerMain.java +++ b/example/src/test/java/com/alipay/sofa/rpc/zookeeper/start/ZookeeperBoltServerMain.java @@ -47,9 +47,14 @@ public static void main(String[] args) { /** * 运行需要pom.xml里增加依赖 - org.apache.curator - curator-recipes - test + org.apache.curator + curator-framework + test + + + org.apache.curator + curator-x-discovery + test */ RegistryConfig registryConfig = new RegistryConfig() diff --git a/log-common-tools/src/main/java/com/alipay/sofa/rpc/log/factory/RpcLoggerFactory.java b/log-common-tools/src/main/java/com/alipay/sofa/rpc/log/factory/RpcLoggerFactory.java index 22b656a58..521d8227d 100644 --- a/log-common-tools/src/main/java/com/alipay/sofa/rpc/log/factory/RpcLoggerFactory.java +++ b/log-common-tools/src/main/java/com/alipay/sofa/rpc/log/factory/RpcLoggerFactory.java @@ -17,7 +17,7 @@ package com.alipay.sofa.rpc.log.factory; import com.alipay.sofa.common.log.LoggerSpaceManager; -import com.alipay.sofa.common.log.SpaceId; +import com.alipay.sofa.common.space.SpaceId; import java.util.HashMap; import java.util.Map; diff --git a/pom.xml b/pom.xml index 4974403de..b4a630be9 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ - 5.11.0-SNAPSHOT + 5.11.0 1.33 true true diff --git a/registry/registry-zk/pom.xml b/registry/registry-zk/pom.xml index 093615afb..cd221fb02 100644 --- a/registry/registry-zk/pom.xml +++ b/registry/registry-zk/pom.xml @@ -28,7 +28,15 @@ org.apache.curator - curator-recipes + curator-framework + + + org.apache.curator + curator-x-discovery + + + org.apache.zookeeper + zookeeper diff --git a/test/test-integration-3rd/pom.xml b/test/test-integration-3rd/pom.xml index 81a723ccb..c64fcc0cd 100644 --- a/test/test-integration-3rd/pom.xml +++ b/test/test-integration-3rd/pom.xml @@ -38,7 +38,7 @@ - com.alibaba + org.apache.dubbo dubbo diff --git a/test/test-integration-3rd/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboServerTest.java b/test/test-integration-3rd/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboServerTest.java index b2820397b..98baa2684 100644 --- a/test/test-integration-3rd/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboServerTest.java +++ b/test/test-integration-3rd/src/test/java/com/alipay/sofa/rpc/bootstrap/dubbo/DubboServerTest.java @@ -28,7 +28,11 @@ import com.alipay.sofa.rpc.registry.base.BaseZkTest; import com.alipay.sofa.rpc.test.HelloService; import com.alipay.sofa.rpc.test.HelloServiceImpl; +import org.apache.dubbo.config.ConfigKeys; +import org.apache.dubbo.config.context.ConfigMode; +import org.junit.AfterClass; import org.junit.Assert; +import org.junit.BeforeClass; import org.junit.Test; import java.util.ArrayList; @@ -39,6 +43,34 @@ */ public class DubboServerTest extends BaseZkTest { + private static String OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE; + private static String OLD_VALUE_DUBBO_CONFIG_MODE; + + @BeforeClass + public static void beforeClass() { + OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE = System + .getProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE); + OLD_VALUE_DUBBO_CONFIG_MODE = System.getProperty(ConfigKeys.DUBBO_CONFIG_MODE); + System.setProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE, "true"); + System.setProperty(ConfigKeys.DUBBO_CONFIG_MODE, ConfigMode.IGNORE.name()); + } + + @AfterClass + public static void afterClass() { + if (OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE != null) { + System.setProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE, + OLD_VALUE_DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE); + } else { + System.clearProperty(ConfigKeys.DUBBO_CONFIG_IGNORE_DUPLICATED_INTERFACE); + } + + if (OLD_VALUE_DUBBO_CONFIG_MODE != null) { + System.setProperty(ConfigKeys.DUBBO_CONFIG_MODE, OLD_VALUE_DUBBO_CONFIG_MODE); + } else { + System.clearProperty(ConfigKeys.DUBBO_CONFIG_MODE); + } + } + @Test //同步调用,走服务注册中心 public void testRegistrySync() {