diff --git a/.github/workflows/cloud_code_scan.yml b/.github/workflows/cloud_code_scan.yml
new file mode 100644
index 000000000..f735fd3d9
--- /dev/null
+++ b/.github/workflows/cloud_code_scan.yml
@@ -0,0 +1,22 @@
+name: Alipay Cloud Devops Codescan
+on:
+ pull_request_target:
+jobs:
+ stc: #安全扫描
+ runs-on: ubuntu-latest
+ steps:
+ - name: codeScan
+ uses: layotto/alipay-cloud-devops-codescan@main
+ with:
+ parent_uid: ${{ secrets.ALI_PID }}
+ private_key: ${{ secrets.ALI_PK }}
+ scan_type: stc
+ sca: # 开源合规
+ runs-on: ubuntu-latest
+ steps:
+ - name: codeScan
+ uses: layotto/alipay-cloud-devops-codescan@main
+ with:
+ parent_uid: ${{ secrets.ALI_PID }}
+ private_key: ${{ secrets.ALI_PK }}
+ scan_type: sca
diff --git a/.gitignore b/.gitignore
index 72806b479..17e9070c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,4 +21,6 @@ logs/
#protobuf
example/build/*
-test/test-integration/build/*
\ No newline at end of file
+test/test-integration/build/*
+
+registry/registry-polaris/polaris/
\ No newline at end of file
diff --git a/README.md b/README.md
index d6f4a0914..fca3ecbba 100644
--- a/README.md
+++ b/README.md
@@ -5,6 +5,7 @@
![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)
[![Maven](https://img.shields.io/github/release/sofastack/sofa-rpc.svg)](https://github.com/sofastack/sofa-rpc/releases)
[![Percentage of issues still open](https://isitmaintained.com/badge/open/sofastack/sofa-rpc.svg)](https://isitmaintained.com/project/sofastack/sofa-rpc "Percentage of issues still open")
+[![Open in CodeBlitz](https://img.shields.io/badge/Ant_Codespaces-Open_in_CodeBlitz-1677ff)](https://codeblitz.cloud.alipay.com/github/sofastack/sofa-rpc)
## Overview
diff --git a/README_zh_CN.md b/README_zh_CN.md
index 6a9fbfcc1..c172a3c9b 100644
--- a/README_zh_CN.md
+++ b/README_zh_CN.md
@@ -4,6 +4,7 @@
[![Coverage Status](https://codecov.io/gh/sofastack/sofa-rpc/branch/master/graph/badge.svg)](https://codecov.io/gh/sofastack/sofa-rpc)
![License](https://img.shields.io/badge/license-Apache--2.0-green.svg)
[![Maven](https://img.shields.io/github/release/sofastack/sofa-rpc.svg)](https://github.com/sofastack/sofa-rpc/releases)
+[![Open in CodeBlitz](https://img.shields.io/badge/Ant_Codespaces-Open_in_CodeBlitz-1677ff)](https://codeblitz.cloud.alipay.com/github/sofastack/sofa-rpc)
SOFARPC 是一个高可扩展性、高性能、生产级的 Java RPC 框架。在蚂蚁金服 SOFARPC 已经经历了十多年及五代版本的发展。SOFARPC 致力于简化应用之间的 RPC 调用,为应用提供方便透明、稳定高效的点对点远程服务调用方案。为了用户和开发者方便的进行功能扩展,SOFARPC 提供了丰富的模型抽象和可扩展接口,包括过滤器、路由、负载均衡等等。同时围绕 SOFARPC 框架及其周边组件提供丰富的微服务治理方案。
diff --git a/SECURITY.md b/SECURITY.md
index 137842035..08e44628b 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -7,3 +7,13 @@ If you have apprehensions regarding SOFAStack's security or you discover vulnera
In the mail, specify the description of the issue or potential threat. You are also urged to recommend the way to reproduce and replicate the issue. The SOFAStack community will get back to you after assessing and analysing the findings.
PLEASE PAY ATTENTION to report the security issue on the security email before disclosing it on public domain.
+
+## Solution
+
+SOFARPC uses Hessian serialization by default. Hessian is a binary serialization protocol. For more information, please refer to Hessian's [documentation](https://github.com/sofastack/sofa-hessian).
+
+Because of the implement of Hessian, by constructing a specific serialization stream, it may cause arbitrary code execution when doing deserialization. It is recommended that users configure blacklist to solve the problem.
+
+SOFARPC also provides a way to configure blacklists in `BlackListFileLoader`, you can override the blacklist configuration based on the code.
+
+The blacklist built into the project comes from internal practices and external contributions, and is for reference only and is not actively updated, we do not assume any legal responsibility for this.
\ No newline at end of file
diff --git a/all/pom.xml b/all/pom.xml
index 599caf2bd..8f92f16ce 100644
--- a/all/pom.xml
+++ b/all/pom.xml
@@ -6,7 +6,7 @@
com.alipay.sofa
sofa-rpc-all
- 5.10.1
+ 5.11.1
${project.groupId}:${project.artifactId}
@@ -57,21 +57,21 @@
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.5.10
+ 1.6.6
3.0.8
1.4.1
1.9.8
- 5.2.0
+ 6.3.0
1.6.9
7.0
4.5.13
4.4.13
- 1.33.1
- 27.0-jre
+ 1.53.0
+ 32.0.0-jre
2.12.1
@@ -183,6 +183,11 @@
sofa-rpc-codec-jackson
${project.version}
+
+ com.alipay.sofa
+ sofa-rpc-codec-sofa-fury
+ ${project.version}
+
com.alipay.sofa
sofa-rpc-fault-tolerance
@@ -519,6 +524,7 @@
com.alipay.sofa:sofa-rpc-codec-jackson
com.alipay.sofa:sofa-rpc-codec-msgpack
com.alipay.sofa:sofa-rpc-codec-sofa-hessian
+ com.alipay.sofa:sofa-rpc-codec-sofa-fury
com.alipay.sofa:sofa-rpc-fault-tolerance
com.alipay.sofa:sofa-rpc-fault-hystrix
com.alipay.sofa:sofa-rpc-log-common-tools
diff --git a/bom/pom.xml b/bom/pom.xml
index fed07d3ba..dabab0d2b 100644
--- a/bom/pom.xml
+++ b/bom/pom.xml
@@ -10,8 +10,8 @@
pom
- 5.10.1
- 3.28.0-GA
+ 5.11.1
+ 3.29.2-GA
1.9.8
4.1.77.Final
@@ -20,25 +20,27 @@
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
- 5.2.0
+ 6.3.0
1.2.2
1.6.9
7.0
- 27.0-jre
+ 32.0.0-jre
0.16.0
- 3.4.0
+ 3.5.0
0.9.2
- 3.16.3
+ 3.22.0
2.12.7
2.12.7.1
0.6.12
1.5.9
- 1.33.1
+ 0.4.1
+ 1.53.0
4.4.13
@@ -51,7 +53,7 @@
4.13.1
- 1.5.10
+ 1.6.6
1.3.2
3.0.8
1.4.1
@@ -297,28 +299,49 @@
msgpack
${msgpack.version}
+
+ org.furyio
+ fury-core
+ ${fury.version}
+
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 +515,18 @@
+
+ org.apache.curator
+ curator-test
+ ${curator.version}
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+ test
+
junit
junit
@@ -514,7 +549,7 @@
io.netty
netty-tcnative-boringssl-static
- 2.0.25.Final
+ 2.0.59.Final
${os.detected.classifier}
@@ -557,6 +592,12 @@
${prometheus.client.version}
test
+
+ io.prometheus
+ simpleclient_hotspot
+ 0.16.0
+ test
+
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/codec/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoader.java b/codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/common/BlackAndWhiteListFileLoader.java
similarity index 59%
rename from codec/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoader.java
rename to codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/common/BlackAndWhiteListFileLoader.java
index 8b48c7a7b..54f4ddf64 100644
--- a/codec/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoader.java
+++ b/codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/common/BlackAndWhiteListFileLoader.java
@@ -14,10 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package com.alipay.sofa.rpc.codec.sofahessian;
+package com.alipay.sofa.rpc.codec.common;
-import com.alipay.sofa.rpc.common.SofaConfigs;
-import com.alipay.sofa.rpc.common.SofaOptions;
+import com.alipay.sofa.common.config.SofaConfigs;
import com.alipay.sofa.rpc.common.utils.StringUtils;
import com.alipay.sofa.rpc.log.Logger;
import com.alipay.sofa.rpc.log.LoggerFactory;
@@ -30,6 +29,8 @@
import java.util.LinkedList;
import java.util.List;
+import static com.alipay.sofa.rpc.common.config.RpcConfigKeys.SERIALIZE_BLACKLIST_OVERRIDE;
+import static com.alipay.sofa.rpc.common.config.RpcConfigKeys.SERIALIZE_WHITELIST_OVERRIDE;
import static com.alipay.sofa.rpc.common.utils.IOUtils.closeQuietly;
/**
@@ -37,21 +38,24 @@
*
* @author GengZhang
*/
-public class BlackListFileLoader {
+public class BlackAndWhiteListFileLoader {
- private static final Logger LOGGER = LoggerFactory.getLogger(BlackListFileLoader.class);
+ private static final Logger LOGGER = LoggerFactory
+ .getLogger(BlackAndWhiteListFileLoader.class);
- public static final List SOFA_SERIALIZE_BLACK_LIST = loadFile("/sofa-rpc/serialize_blacklist.txt");
+ public static final List SOFA_SERIALIZE_BLACK_LIST = loadBlackListFile("/sofa-rpc/serialize_blacklist.txt");
- static List loadFile(String path) {
- List blackPrefixList = new ArrayList();
+ public static final List SOFA_SERIALIZER_WHITE_LIST = loadWhiteListFile("/sofa-rpc/serialize_whitelist.txt");
+
+ public static List loadBlackListFile(String path) {
+ List blackPrefixList = new ArrayList<>();
InputStream input = null;
try {
- input = BlackListFileLoader.class.getResourceAsStream(path);
+ input = BlackAndWhiteListFileLoader.class.getResourceAsStream(path);
if (input != null) {
readToList(input, "UTF-8", blackPrefixList);
}
- String overStr = SofaConfigs.getStringValue(SofaOptions.CONFIG_SERIALIZE_BLACKLIST_OVERRIDE, "");
+ String overStr = SofaConfigs.getOrCustomDefault(SERIALIZE_BLACKLIST_OVERRIDE, "");
if (StringUtils.isNotBlank(overStr)) {
if (LOGGER.isInfoEnabled()) {
LOGGER.info("Serialize blacklist will override with configuration: {}", overStr);
@@ -68,6 +72,31 @@ static List loadFile(String path) {
return blackPrefixList;
}
+ public static List loadWhiteListFile(String path) {
+ List whitePrefixList = new ArrayList<>();
+ InputStream input = null;
+ try {
+ input = BlackAndWhiteListFileLoader.class.getResourceAsStream(path);
+ if (input != null) {
+ readToList(input, "UTF-8", whitePrefixList);
+ }
+ String overStr = SofaConfigs.getOrCustomDefault(SERIALIZE_WHITELIST_OVERRIDE, "");
+ if (StringUtils.isNotBlank(overStr)) {
+ if (LOGGER.isInfoEnabled()) {
+ LOGGER.info("Serialize whitelist will override with configuration: {}", overStr);
+ }
+ overrideWhiteList(whitePrefixList, overStr);
+ }
+ } catch (Exception e) {
+ if (LOGGER.isErrorEnabled()) {
+ LOGGER.error(e.getMessage(), e);
+ }
+ } finally {
+ closeQuietly(input);
+ }
+ return whitePrefixList;
+ }
+
/**
* 读文件,将结果丢入List
*
@@ -100,12 +129,12 @@ private static void readToList(InputStream input, String encoding, List
/**
* Override blacklist with override string.
- *
- * @param originList Origin black list
+ *
+ * @param originList Origin black list
* @param overrideStr The override string
*/
- static void overrideBlackList(List originList, String overrideStr) {
- List adds = new LinkedList();
+ public static void overrideBlackList(List originList, String overrideStr) {
+ List adds = new LinkedList<>();
String[] overrideItems = StringUtils.splitWithCommaOrSemicolon(overrideStr);
for (String overrideItem : overrideItems) {
if (StringUtils.isNotBlank(overrideItem)) {
@@ -127,4 +156,19 @@ static void overrideBlackList(List originList, String overrideStr) {
originList.addAll(adds);
}
}
+
+ public static void overrideWhiteList(List originList, String overrideStr) {
+ List adds = new LinkedList<>();
+ String[] overrideItems = StringUtils.splitWithCommaOrSemicolon(overrideStr);
+ for (String overrideItem : overrideItems) {
+ if (StringUtils.isNotBlank(overrideItem)) {
+ if (!originList.contains(overrideItem)) {
+ adds.add(overrideItem);
+ }
+ }
+ }
+ if (adds.size() > 0) {
+ originList.addAll(adds);
+ }
+ }
}
diff --git a/codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/common/SerializeCheckStatus.java b/codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/common/SerializeCheckStatus.java
new file mode 100644
index 000000000..bcedf2101
--- /dev/null
+++ b/codec/codec-api/src/main/java/com/alipay/sofa/rpc/codec/common/SerializeCheckStatus.java
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.common;
+
+/**
+ * @author Even
+ * @date 2024/1/5 19:12
+ */
+public enum SerializeCheckStatus {
+ /**
+ * Disable serialize check for all classes
+ */
+ DISABLE(0),
+
+ /**
+ * Only deny danger classes, warn if other classes are not in allow list
+ */
+ WARN(1),
+
+ /**
+ * Only allow classes in allow list, deny if other classes are not in allow list
+ */
+ STRICT(2);
+
+ private final int mode;
+
+ SerializeCheckStatus(int mode) {
+ this.mode = mode;
+ }
+
+ public int getSerializeCheckMode() {
+ return mode;
+ }
+}
diff --git a/codec/codec-sofa-hessian/src/main/resources/sofa-rpc/serialize_blacklist.txt b/codec/codec-api/src/main/resources/sofa-rpc/serialize_blacklist.txt
similarity index 97%
rename from codec/codec-sofa-hessian/src/main/resources/sofa-rpc/serialize_blacklist.txt
rename to codec/codec-api/src/main/resources/sofa-rpc/serialize_blacklist.txt
index bbf1c7e1c..b25affe9a 100644
--- a/codec/codec-sofa-hessian/src/main/resources/sofa-rpc/serialize_blacklist.txt
+++ b/codec/codec-api/src/main/resources/sofa-rpc/serialize_blacklist.txt
@@ -24,6 +24,8 @@ javax.naming.InitialContext
javax.naming.spi.ObjectFactory
javax.script.ScriptEngineManager
javax.sound.sampled.AudioFormat$Encoding
+javax.sound.sampled.AudioFileFormat
+javax.swing.UIDefaults
org.apache.carbondata.core.scan.expression.ExpressionResult
org.apache.commons.dbcp.datasources.SharedPoolDataSource
org.apache.ibatis.executor.loader.AbstractSerialStateHolder
diff --git a/codec/codec-sofa-fury/pom.xml b/codec/codec-sofa-fury/pom.xml
new file mode 100644
index 000000000..70150a8f9
--- /dev/null
+++ b/codec/codec-sofa-fury/pom.xml
@@ -0,0 +1,46 @@
+
+
+ 4.0.0
+
+
+ com.alipay.sofa
+ sofa-rpc-codec
+ ${revision}
+
+
+ sofa-rpc-codec-sofa-fury
+
+
+
+ com.alipay.sofa
+ sofa-rpc-codec-api
+
+
+ com.alipay.sofa
+ sofa-rpc-api
+
+
+ com.alipay.sofa
+ sofa-rpc-log
+
+
+
+
+ org.furyio
+ fury-core
+
+
+
+ org.slf4j
+ slf4j-log4j12
+ test
+
+
+ junit
+ junit
+ test
+
+
+
diff --git a/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/FurySerializer.java b/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/FurySerializer.java
new file mode 100644
index 000000000..e1a61a6fd
--- /dev/null
+++ b/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/FurySerializer.java
@@ -0,0 +1,182 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury;
+
+import com.alipay.sofa.common.config.SofaConfigs;
+import com.alipay.sofa.rpc.codec.AbstractSerializer;
+import com.alipay.sofa.rpc.codec.CustomSerializer;
+import com.alipay.sofa.rpc.codec.common.BlackAndWhiteListFileLoader;
+import com.alipay.sofa.rpc.codec.common.SerializeCheckStatus;
+import com.alipay.sofa.rpc.codec.fury.serialize.SofaRequestFurySerializer;
+import com.alipay.sofa.rpc.codec.fury.serialize.SofaResponseFurySerializer;
+import com.alipay.sofa.rpc.common.config.RpcConfigKeys;
+import com.alipay.sofa.rpc.core.exception.SofaRpcException;
+import com.alipay.sofa.rpc.core.request.SofaRequest;
+import com.alipay.sofa.rpc.core.response.SofaResponse;
+import com.alipay.sofa.rpc.ext.Extension;
+import com.alipay.sofa.rpc.transport.AbstractByteBuf;
+import com.alipay.sofa.rpc.transport.ByteArrayWrapperByteBuf;
+import io.fury.Fury;
+import io.fury.ThreadLocalFury;
+import io.fury.config.Language;
+import io.fury.memory.MemoryBuffer;
+import io.fury.resolver.AllowListChecker;
+
+import java.util.List;
+import java.util.Map;
+
+import static io.fury.config.CompatibleMode.COMPATIBLE;
+
+/**
+ * @author lipan
+ */
+@Extension(value = "fury2", code = 22)
+public class FurySerializer extends AbstractSerializer {
+
+ private final ThreadLocalFury fury;
+
+ private final String checkerMode = SofaConfigs.getOrDefault(RpcConfigKeys.SERIALIZE_CHECKER_MODE);
+
+ public FurySerializer() {
+ fury = new ThreadLocalFury(classLoader -> {
+ Fury f = Fury.builder().withLanguage(Language.JAVA)
+ .withRefTracking(true)
+ .withCodegen(true)
+ .withNumberCompressed(true)
+ .withCompatibleMode(COMPATIBLE)
+ .requireClassRegistration(false)
+ .withClassLoader(classLoader)
+ .withAsyncCompilation(true)
+ .build();
+
+ // Do not use any configuration
+ if (checkerMode.equalsIgnoreCase(SerializeCheckStatus.DISABLE.name())) {
+ AllowListChecker noChecker = new AllowListChecker(AllowListChecker.CheckLevel.DISABLE);
+ f.getClassResolver().setClassChecker(noChecker);
+ return f;
+ } else if (checkerMode.equalsIgnoreCase(SerializeCheckStatus.WARN.name())) {
+ AllowListChecker blackListChecker = new AllowListChecker(AllowListChecker.CheckLevel.WARN);
+ List blackList = BlackAndWhiteListFileLoader.SOFA_SERIALIZE_BLACK_LIST;
+ // To setting checker
+ f.getClassResolver().setClassChecker(blackListChecker);
+ blackListChecker.addListener(f.getClassResolver());
+ // BlackList classes use wildcards
+ for (String key : blackList) {
+ blackListChecker.disallowClass(key + "*");
+ }
+ } else if (checkerMode.equalsIgnoreCase(SerializeCheckStatus.STRICT.name())) {
+ AllowListChecker blackAndWhiteListChecker = new AllowListChecker(AllowListChecker.CheckLevel.STRICT);
+ List whiteList = BlackAndWhiteListFileLoader.SOFA_SERIALIZER_WHITE_LIST;
+ // To setting checker
+ f.getClassResolver().setClassChecker(blackAndWhiteListChecker);
+ blackAndWhiteListChecker.addListener(f.getClassResolver());
+ // WhiteList classes use wildcards
+ for (String key : whiteList) {
+ blackAndWhiteListChecker.allowClass(key + "*");
+ }
+ List blackList = BlackAndWhiteListFileLoader.SOFA_SERIALIZE_BLACK_LIST;
+ // To setting checker
+ f.getClassResolver().setClassChecker(blackAndWhiteListChecker);
+ blackAndWhiteListChecker.addListener(f.getClassResolver());
+ // BlackList classes use wildcards
+ for (String key : blackList) {
+ blackAndWhiteListChecker.disallowClass(key + "*");
+ }
+ }
+ f.register(SofaRequest.class);
+ f.register(SofaResponse.class);
+ f.register(SofaRpcException.class);
+ return f;
+ });
+ addSerializer(SofaRequest.class, new SofaRequestFurySerializer(fury));
+ addSerializer(SofaResponse.class, new SofaResponseFurySerializer(fury));
+ }
+
+ @Override
+ public AbstractByteBuf encode(final Object object, final Map context) throws SofaRpcException {
+ if (object == null) {
+ throw buildSerializeError("Unsupported null message!");
+ }
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ fury.setClassLoader(contextClassLoader);
+ CustomSerializer customSerializer = getObjCustomSerializer(object);
+ if (customSerializer != null) {
+ return customSerializer.encodeObject(object, context);
+ } else {
+ MemoryBuffer writeBuffer = MemoryBuffer.newHeapBuffer(32);
+ writeBuffer.writerIndex(0);
+ fury.serialize(writeBuffer, object);
+ return new ByteArrayWrapperByteBuf(writeBuffer.getBytes(0, writeBuffer.writerIndex()));
+ }
+ } catch (Exception e) {
+ throw buildSerializeError(e.getMessage(), e);
+ } finally {
+ fury.clearClassLoader(contextClassLoader);
+ }
+ }
+
+ @Override
+ public Object decode(final AbstractByteBuf data, final Class clazz, final Map context)
+ throws SofaRpcException {
+ if (data.readableBytes() <= 0 || clazz == null) {
+ throw buildDeserializeError("Deserialized array is empty.");
+ }
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ fury.setClassLoader(contextClassLoader);
+ CustomSerializer customSerializer = getSerializer(clazz);
+ if (customSerializer != null) {
+ return customSerializer.decodeObject(data, context);
+ } else {
+ MemoryBuffer readBuffer = MemoryBuffer.fromByteArray(data.array());
+ return fury.deserialize(readBuffer);
+ }
+ } catch (Exception e) {
+ throw buildDeserializeError(e.getMessage(), e);
+ } finally {
+ fury.clearClassLoader(contextClassLoader);
+ }
+ }
+
+ @Override
+ public void decode(final AbstractByteBuf data, final Object template, final Map context)
+ throws SofaRpcException {
+ if (template == null) {
+ throw buildDeserializeError("template is null!");
+ }
+ ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
+ try {
+ fury.setClassLoader(contextClassLoader);
+ CustomSerializer customSerializer = getObjCustomSerializer(template);
+ if (customSerializer != null) {
+ customSerializer.decodeObjectByTemplate(data, context, template);
+ } else {
+ throw buildDeserializeError("Only support decode from SofaRequest and SofaResponse template");
+ }
+ } catch (Exception e) {
+ throw buildDeserializeError(e.getMessage(), e);
+ } finally {
+ fury.clearClassLoader(contextClassLoader);
+ }
+ }
+
+ public ThreadLocalFury getFury() {
+ return fury;
+ }
+
+}
diff --git a/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/serialize/SofaRequestFurySerializer.java b/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/serialize/SofaRequestFurySerializer.java
new file mode 100644
index 000000000..9122c0c18
--- /dev/null
+++ b/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/serialize/SofaRequestFurySerializer.java
@@ -0,0 +1,117 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.serialize;
+
+import com.alipay.sofa.rpc.codec.CustomSerializer;
+import com.alipay.sofa.rpc.common.RemotingConstants;
+import com.alipay.sofa.rpc.config.ConfigUniqueNameGenerator;
+import com.alipay.sofa.rpc.core.exception.SofaRpcException;
+import com.alipay.sofa.rpc.core.request.SofaRequest;
+import com.alipay.sofa.rpc.transport.AbstractByteBuf;
+import com.alipay.sofa.rpc.transport.ByteArrayWrapperByteBuf;
+import io.fury.ThreadLocalFury;
+import io.fury.memory.MemoryBuffer;
+
+import java.util.Map;
+
+/**
+ * @author Even
+ * @date 2024/1/4 19:29
+ */
+public class SofaRequestFurySerializer implements CustomSerializer {
+
+ private final ThreadLocalFury fury;
+
+ public SofaRequestFurySerializer(ThreadLocalFury fury) {
+ this.fury = fury;
+ }
+
+ @Override
+ public AbstractByteBuf encodeObject(SofaRequest object, Map context) throws SofaRpcException {
+ try {
+ MemoryBuffer writeBuffer = MemoryBuffer.newHeapBuffer(32);
+ writeBuffer.writerIndex(0);
+
+ // 根据SerializeType信息决定序列化器
+ boolean genericSerialize = context != null &&
+ isGenericRequest(context.get(RemotingConstants.HEAD_GENERIC_TYPE));
+ if (genericSerialize) {
+ // TODO support generic call
+ throw new SofaRpcException("Generic call is not supported for now.");
+ }
+ fury.serialize(writeBuffer, object);
+ final Object[] args = object.getMethodArgs();
+ fury.serialize(writeBuffer, args);
+
+ return new ByteArrayWrapperByteBuf(writeBuffer.getBytes(0, writeBuffer.writerIndex()));
+ } catch (Exception e) {
+ throw new SofaRpcException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public SofaRequest decodeObject(AbstractByteBuf data, Map context) throws SofaRpcException {
+ MemoryBuffer readBuffer = MemoryBuffer.fromByteArray(data.array());
+ try {
+ SofaRequest sofaRequest = (SofaRequest) fury.deserialize(readBuffer);
+ String targetServiceName = sofaRequest.getTargetServiceUniqueName();
+ if (targetServiceName == null) {
+ throw new SofaRpcException("Target service name of request is null!");
+ }
+ String interfaceName = ConfigUniqueNameGenerator.getInterfaceName(targetServiceName);
+ sofaRequest.setInterfaceName(interfaceName);
+ final Object[] args = (Object[]) fury.deserialize(readBuffer);
+ sofaRequest.setMethodArgs(args);
+ return sofaRequest;
+ } catch (Exception e) {
+ throw new SofaRpcException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void decodeObjectByTemplate(AbstractByteBuf data, Map context, SofaRequest template)
+ throws SofaRpcException {
+ if (data.readableBytes() <= 0) {
+ throw new SofaRpcException("Deserialized array is empty.");
+ }
+ try {
+ MemoryBuffer readBuffer = MemoryBuffer.fromByteArray(data.array());
+ SofaRequest tmp = (SofaRequest) fury.deserialize(readBuffer);
+ String targetServiceName = tmp.getTargetServiceUniqueName();
+ if (targetServiceName == null) {
+ throw new SofaRpcException("Target service name of request is null!");
+ }
+ // copy values to template
+ template.setMethodName(tmp.getMethodName());
+ template.setMethodArgSigs(tmp.getMethodArgSigs());
+ template.setTargetServiceUniqueName(tmp.getTargetServiceUniqueName());
+ template.setTargetAppName(tmp.getTargetAppName());
+ template.addRequestProps(tmp.getRequestProps());
+ String interfaceName = ConfigUniqueNameGenerator.getInterfaceName(targetServiceName);
+ template.setInterfaceName(interfaceName);
+ final Object[] args = (Object[]) fury.deserialize(readBuffer);
+ template.setMethodArgs(args);
+ } catch (Exception e) {
+ throw new SofaRpcException(e.getMessage(), e);
+ }
+ }
+
+ protected boolean isGenericRequest(String serializeType) {
+ return serializeType != null && !serializeType.equals(RemotingConstants.SERIALIZE_FACTORY_NORMAL);
+ }
+
+}
diff --git a/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/serialize/SofaResponseFurySerializer.java b/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/serialize/SofaResponseFurySerializer.java
new file mode 100644
index 000000000..9a7402ab1
--- /dev/null
+++ b/codec/codec-sofa-fury/src/main/java/com/alipay/sofa/rpc/codec/fury/serialize/SofaResponseFurySerializer.java
@@ -0,0 +1,102 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.serialize;
+
+import com.alipay.sofa.rpc.codec.CustomSerializer;
+import com.alipay.sofa.rpc.common.RemotingConstants;
+import com.alipay.sofa.rpc.core.exception.SofaRpcException;
+import com.alipay.sofa.rpc.core.response.SofaResponse;
+import com.alipay.sofa.rpc.transport.AbstractByteBuf;
+import com.alipay.sofa.rpc.transport.ByteArrayWrapperByteBuf;
+import io.fury.ThreadLocalFury;
+import io.fury.memory.MemoryBuffer;
+
+import java.util.Map;
+
+/**
+ * @author Even
+ * @date 2024/1/4 19:30
+ */
+public class SofaResponseFurySerializer implements CustomSerializer {
+
+ private final ThreadLocalFury fury;
+
+ public SofaResponseFurySerializer(ThreadLocalFury fury) {
+ this.fury = fury;
+ }
+
+ @Override
+ public AbstractByteBuf encodeObject(SofaResponse object, Map context) throws SofaRpcException {
+ try {
+ fury.setClassLoader(Thread.currentThread().getContextClassLoader());
+ MemoryBuffer writeBuffer = MemoryBuffer.newHeapBuffer(32);
+ writeBuffer.writerIndex(0);
+ fury.serialize(writeBuffer, object);
+ return new ByteArrayWrapperByteBuf(writeBuffer.getBytes(0, writeBuffer.writerIndex()));
+ } catch (Exception e) {
+ throw new SofaRpcException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public SofaResponse decodeObject(AbstractByteBuf data, Map context) throws SofaRpcException {
+ MemoryBuffer readBuffer = MemoryBuffer.fromByteArray(data.array());
+ try {
+ fury.setClassLoader(Thread.currentThread().getContextClassLoader());
+ boolean genericSerialize = context != null && isGenericResponse(
+ context.get(RemotingConstants.HEAD_GENERIC_TYPE));
+ if (genericSerialize) {
+ // TODO support generic call
+ throw new SofaRpcException("Generic call is not supported for now.");
+ }
+ return (SofaResponse) fury.deserialize(readBuffer);
+ } catch (Exception e) {
+ throw new SofaRpcException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ public void decodeObjectByTemplate(AbstractByteBuf data, Map context, SofaResponse template)
+ throws SofaRpcException {
+ if (data.readableBytes() <= 0) {
+ throw new SofaRpcException("Deserialized array is empty.");
+ }
+ try {
+ fury.setClassLoader(Thread.currentThread().getContextClassLoader());
+ MemoryBuffer readBuffer = MemoryBuffer.fromByteArray(data.array());
+ // 根据SerializeType信息决定序列化器
+ boolean genericSerialize = context != null && isGenericResponse(
+ context.get(RemotingConstants.HEAD_GENERIC_TYPE));
+ if (genericSerialize) {
+ // TODO support generic call
+ throw new SofaRpcException("Generic call is not supported for now.");
+ } else {
+ SofaResponse tmp = (SofaResponse) fury.deserialize(readBuffer);
+ // copy values to template
+ template.setErrorMsg(tmp.getErrorMsg());
+ template.setAppResponse(tmp.getAppResponse());
+ template.setResponseProps(tmp.getResponseProps());
+ }
+ } catch (Exception e) {
+ throw new SofaRpcException(e.getMessage(), e);
+ }
+ }
+
+ protected boolean isGenericResponse(String serializeType) {
+ return serializeType != null && serializeType.equals(RemotingConstants.SERIALIZE_FACTORY_GENERIC);
+ }
+}
diff --git a/codec/codec-sofa-fury/src/main/resources/META-INF/services/sofa-rpc/com.alipay.sofa.rpc.codec.Serializer b/codec/codec-sofa-fury/src/main/resources/META-INF/services/sofa-rpc/com.alipay.sofa.rpc.codec.Serializer
new file mode 100644
index 000000000..dc727a0dd
--- /dev/null
+++ b/codec/codec-sofa-fury/src/main/resources/META-INF/services/sofa-rpc/com.alipay.sofa.rpc.codec.Serializer
@@ -0,0 +1 @@
+fury2=com.alipay.sofa.rpc.codec.fury.FurySerializer
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/FurySerializerTest.java b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/FurySerializerTest.java
new file mode 100644
index 000000000..fc4fde8cc
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/FurySerializerTest.java
@@ -0,0 +1,289 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury;
+
+import com.alipay.sofa.rpc.codec.Serializer;
+import com.alipay.sofa.rpc.codec.fury.model.blacklist.BlackListClass;
+import com.alipay.sofa.rpc.codec.fury.model.none.NoneClassHasBlackClass;
+import com.alipay.sofa.rpc.codec.fury.model.whitelist.DemoRequest;
+import com.alipay.sofa.rpc.codec.fury.model.whitelist.DemoResponse;
+import com.alipay.sofa.rpc.codec.fury.model.whitelist.WhiteClassHasBlackClass;
+import com.alipay.sofa.rpc.codec.fury.model.whitelist.DemoService;
+import com.alipay.sofa.rpc.common.RemotingConstants;
+import com.alipay.sofa.rpc.common.RpcConstants;
+import com.alipay.sofa.rpc.core.exception.SofaRpcException;
+import com.alipay.sofa.rpc.core.invoke.SofaResponseCallback;
+import com.alipay.sofa.rpc.core.request.RequestBase;
+import com.alipay.sofa.rpc.core.request.SofaRequest;
+import com.alipay.sofa.rpc.core.response.SofaResponse;
+import com.alipay.sofa.rpc.ext.ExtensionLoaderFactory;
+import com.alipay.sofa.rpc.transport.AbstractByteBuf;
+import com.alipay.sofa.rpc.transport.ByteArrayWrapperByteBuf;
+import org.junit.Assert;
+import org.junit.Test;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @author lipan
+ */
+public class FurySerializerTest {
+
+ private final FurySerializer serializer = (FurySerializer) ExtensionLoaderFactory.getExtensionLoader(
+ Serializer.class).getExtension("fury2");
+
+ @Test
+ public void encodeAndDecode() {
+ try {
+ serializer.encode(null, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ DemoRequest demoRequest = new DemoRequest();
+ demoRequest.setName("a");
+ AbstractByteBuf byteBuf = serializer.encode(demoRequest, null);
+ DemoRequest req2 = (DemoRequest) serializer.decode(byteBuf, DemoRequest.class, null);
+ Assert.assertEquals(demoRequest.getName(), req2.getName());
+
+ AbstractByteBuf data = serializer.encode("xxx", null);
+ String dst = (String) serializer.decode(data, String.class, null);
+ Assert.assertEquals("xxx", dst);
+
+ try {
+ serializer.decode(data, null, null);
+ Assert.fail();
+ } catch (Exception e) {
+ }
+
+ try {
+ serializer.decode(data, "", null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void testSofaRequest() throws Exception {
+ SofaRequest request = buildRequest();
+ AbstractByteBuf data = serializer.encode(request, null);
+
+ serializer.encode("123456", null);
+ SofaRequest decode = (SofaRequest) serializer.decode(data, SofaRequest.class, null);
+ assertEqualsSofaRequest(request, decode);
+
+ SofaRequest newRequest = new SofaRequest();
+ serializer.decode(data, newRequest, null);
+ assertEqualsSofaRequest(request, newRequest);
+
+ // null request
+ newRequest = new SofaRequest();
+ try {
+ serializer.decode(new ByteArrayWrapperByteBuf(new byte[0]), newRequest, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+ }
+
+ @Test
+ public void testSofaResponse() throws Exception {
+ SofaResponse response = new SofaResponse();
+ final DemoResponse demoAppResponse = new DemoResponse();
+ demoAppResponse.setWord("result");
+ response.setAppResponse(demoAppResponse);
+ AbstractByteBuf data = serializer.encode(response, null);
+
+ try {
+ serializer.decode(data, null, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ try {
+ serializer.decode(data, new Object(), null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ SofaResponse decode = (SofaResponse) serializer.decode(data, SofaResponse.class, null);
+ Assert.assertFalse(decode.isError());
+ Assert.assertEquals(response.getAppResponse(), decode.getAppResponse());
+ Assert.assertEquals("result", ((DemoResponse) decode.getAppResponse()).getWord());
+
+ // success response
+ SofaResponse newResponse = new SofaResponse();
+ serializer.decode(data, newResponse, null);
+ Assert.assertFalse(newResponse.isError());
+ Assert.assertEquals(response.getAppResponse(), newResponse.getAppResponse());
+ Assert.assertEquals("result", ((DemoResponse) newResponse.getAppResponse()).getWord());
+
+ // null response
+ newResponse = new SofaResponse();
+ try {
+ serializer.decode(new ByteArrayWrapperByteBuf(new byte[0]), newResponse, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+ // error response
+ response = new SofaResponse();
+ response.setErrorMsg("1233");
+ data = serializer.encode(response, null);
+ newResponse = new SofaResponse();
+ serializer.decode(data, newResponse, null);
+ Assert.assertTrue(newResponse.isError());
+ Assert.assertEquals(response.getErrorMsg(), newResponse.getErrorMsg());
+ }
+
+ private SofaRequest buildRequest() throws NoSuchMethodException {
+ SofaRequest request = new SofaRequest();
+ request.setInterfaceName(DemoService.class.getName());
+ request.setMethodName("say");
+ request.setMethod(DemoService.class.getMethod("say", DemoRequest.class));
+ final DemoRequest demoRequest = new DemoRequest();
+ demoRequest.setName("name");
+ request.setMethodArgs(new Object[] { demoRequest });
+ request.setMethodArgSigs(new String[] { DemoRequest.class.getCanonicalName() });
+ request.setTargetServiceUniqueName(DemoService.class.getName() + ":1.0");
+ request.setTargetAppName("targetApp");
+ request.setSerializeType((byte) 22);
+ request.setTimeout(1024);
+ request.setInvokeType(RpcConstants.INVOKER_TYPE_SYNC);
+ Map map = new HashMap();
+ map.put("a", "xxx");
+ map.put("b", "yyy");
+ request.addRequestProp(RemotingConstants.RPC_TRACE_NAME, map);
+ request.setSofaResponseCallback(new SofaResponseCallback() {
+ @Override
+ public void onAppResponse(Object appResponse, String methodName, RequestBase request) {
+
+ }
+
+ @Override
+ public void onAppException(Throwable throwable, String methodName, RequestBase request) {
+
+ }
+
+ @Override
+ public void onSofaException(SofaRpcException sofaException, String methodName, RequestBase request) {
+
+ }
+ });
+ return request;
+ }
+
+ private void assertEqualsSofaRequest(SofaRequest request, SofaRequest decode) {
+ Assert.assertEquals(decode.getInterfaceName(), request.getInterfaceName());
+ Assert.assertEquals(decode.getMethodName(), request.getMethodName());
+ Assert.assertArrayEquals(decode.getMethodArgSigs(), request.getMethodArgSigs());
+ Assert.assertEquals(decode.getMethodArgs().length, request.getMethodArgs().length);
+ Assert.assertEquals("name", ((DemoRequest) decode.getMethodArgs()[0]).getName());
+ Assert.assertEquals(decode.getTargetServiceUniqueName(), request.getTargetServiceUniqueName());
+ Assert.assertEquals(decode.getTargetAppName(), request.getTargetAppName());
+ Assert.assertEquals(decode.getRequestProp(RemotingConstants.RPC_TRACE_NAME),
+ request.getRequestProp(RemotingConstants.RPC_TRACE_NAME));
+ }
+
+ @Test
+ public void testChecker() throws Exception {
+ // default fury checkMode is STRICT
+ WhiteClassHasBlackClass whiteClassNullBlackClass = new WhiteClassHasBlackClass();
+ NoneClassHasBlackClass noneClassNullBlackClass = new NoneClassHasBlackClass();
+
+ BlackListClass blackListClass = new BlackListClass();
+ WhiteClassHasBlackClass whiteClassHasBlackClass = new WhiteClassHasBlackClass();
+ whiteClassHasBlackClass.setBlackListClass(blackListClass);
+ NoneClassHasBlackClass noneClassHasBlackClass = new NoneClassHasBlackClass();
+ noneClassHasBlackClass.setBlackListClass(blackListClass);
+
+ try {
+ serializer.encode(noneClassNullBlackClass, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ try {
+ serializer.encode(noneClassHasBlackClass, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ try {
+ serializer.encode(blackListClass, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ serializer.encode(whiteClassNullBlackClass, null);
+ try {
+ serializer.encode(whiteClassHasBlackClass, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ // test change fury checkMode to blacklist
+ System.getProperties().put("sofa.rpc.codec.serialize.checkMode", "WARN");
+ FurySerializer furySerializer = new FurySerializer();
+
+ furySerializer.encode(noneClassNullBlackClass, null);
+
+ try {
+ furySerializer.encode(noneClassHasBlackClass, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ try {
+ //Not registered this class
+ furySerializer.encode(blackListClass, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+
+ furySerializer.encode(whiteClassNullBlackClass, null);
+ try {
+ furySerializer.encode(whiteClassHasBlackClass, null);
+ Assert.fail();
+ } catch (Exception e) {
+
+ }
+ System.getProperties().remove("sofa.rpc.codec.serialize.checkMode");
+
+ // test change fury checkMode to none
+ System.getProperties().put("sofa.rpc.codec.serialize.checkMode", "DISABLE");
+ FurySerializer noneFurySerializer = new FurySerializer();
+ noneFurySerializer.encode(noneClassNullBlackClass, null);
+ noneFurySerializer.encode(noneClassHasBlackClass, null);
+ noneFurySerializer.encode(blackListClass, null);
+ noneFurySerializer.encode(whiteClassNullBlackClass, null);
+ noneFurySerializer.encode(whiteClassHasBlackClass, null);
+ System.getProperties().remove("sofa.rpc.codec.serialize.checkMode");
+ }
+
+}
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/blacklist/BlackListClass.java b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/blacklist/BlackListClass.java
new file mode 100644
index 000000000..78281a910
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/blacklist/BlackListClass.java
@@ -0,0 +1,24 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.model.blacklist;
+
+/**
+ * @author lipan
+ */
+public class BlackListClass {
+ private String test;
+}
diff --git a/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/none/NoneClassHasBlackClass.java b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/none/NoneClassHasBlackClass.java
new file mode 100644
index 000000000..8ddaaa9a8
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/none/NoneClassHasBlackClass.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.model.none;
+
+import com.alipay.sofa.rpc.codec.fury.model.blacklist.BlackListClass;
+
+/**
+ * @author Even
+ * @date 2024/1/2 11:33
+ */
+public class NoneClassHasBlackClass {
+
+ private BlackListClass blackListClass;
+
+ public BlackListClass getBlackListClass() {
+ return blackListClass;
+ }
+
+ public void setBlackListClass(BlackListClass blackListClass) {
+ this.blackListClass = blackListClass;
+ }
+}
diff --git a/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoRequest.java b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoRequest.java
new file mode 100644
index 000000000..7b9bb7129
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoRequest.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.model.whitelist;
+
+/**
+ * @author lipan
+ */
+public class DemoRequest {
+
+ private String name;
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoResponse.java b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoResponse.java
new file mode 100644
index 000000000..ffca06616
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoResponse.java
@@ -0,0 +1,50 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.model.whitelist;
+
+/**
+ * @author lipan
+ */
+public class DemoResponse {
+
+ private String word;
+
+ public String getWord() {
+ return word;
+ }
+
+ public void setWord(String word) {
+ this.word = word;
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o)
+ return true;
+ if (!(o instanceof DemoResponse))
+ return false;
+
+ DemoResponse that = (DemoResponse) o;
+
+ return word != null ? word.equals(that.word) : that.word == null;
+ }
+
+ @Override
+ public int hashCode() {
+ return word != null ? word.hashCode() : 0;
+ }
+}
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoService.java b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoService.java
new file mode 100644
index 000000000..604473b7b
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/DemoService.java
@@ -0,0 +1,33 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.model.whitelist;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * @author lipan
+ */
+public interface DemoService {
+
+ public DemoResponse say(DemoRequest demoRequest);
+
+ public DemoResponse say2(DemoRequest demoRequest, Map ctx, int id);
+
+ public List say3(List list);
+
+}
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/WhiteClassHasBlackClass.java b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/WhiteClassHasBlackClass.java
new file mode 100644
index 000000000..10e3943fb
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/java/com/alipay/sofa/rpc/codec/fury/model/whitelist/WhiteClassHasBlackClass.java
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec.fury.model.whitelist;
+
+import com.alipay.sofa.rpc.codec.fury.model.blacklist.BlackListClass;
+
+/**
+ * @author lipan
+ */
+public class WhiteClassHasBlackClass {
+
+ private BlackListClass blackListClass;
+
+ public BlackListClass getBlackListClass() {
+ return blackListClass;
+ }
+
+ public void setBlackListClass(BlackListClass blackListClass) {
+ this.blackListClass = blackListClass;
+ }
+}
diff --git a/codec/codec-sofa-fury/src/test/resources/log4j.xml b/codec/codec-sofa-fury/src/test/resources/log4j.xml
new file mode 100644
index 000000000..e95634f16
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/resources/log4j.xml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/resources/sofa-rpc/rpc-config.json b/codec/codec-sofa-fury/src/test/resources/sofa-rpc/rpc-config.json
new file mode 100644
index 000000000..5b573549a
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/resources/sofa-rpc/rpc-config.json
@@ -0,0 +1,4 @@
+{
+ "rpc.config.order": 999,
+ "logger.impl": "com.alipay.sofa.rpc.log.SLF4JLoggerImpl"
+}
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/resources/sofa-rpc/serialize_blacklist.txt b/codec/codec-sofa-fury/src/test/resources/sofa-rpc/serialize_blacklist.txt
new file mode 100644
index 000000000..991e2a54d
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/resources/sofa-rpc/serialize_blacklist.txt
@@ -0,0 +1 @@
+com.alipay.sofa.rpc.codec.fury.model.blacklist.
\ No newline at end of file
diff --git a/codec/codec-sofa-fury/src/test/resources/sofa-rpc/serialize_whitelist.txt b/codec/codec-sofa-fury/src/test/resources/sofa-rpc/serialize_whitelist.txt
new file mode 100644
index 000000000..6f1718654
--- /dev/null
+++ b/codec/codec-sofa-fury/src/test/resources/sofa-rpc/serialize_whitelist.txt
@@ -0,0 +1 @@
+com.alipay.sofa.rpc.codec.fury.model.whitelist.
\ No newline at end of file
diff --git a/codec/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/SofaHessianSerializer.java b/codec/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/SofaHessianSerializer.java
index ae7eac3f0..06ec4a4a6 100644
--- a/codec/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/SofaHessianSerializer.java
+++ b/codec/codec-sofa-hessian/src/main/java/com/alipay/sofa/rpc/codec/sofahessian/SofaHessianSerializer.java
@@ -19,6 +19,7 @@
import com.alipay.hessian.ClassNameResolver;
import com.alipay.hessian.NameBlackListFilter;
import com.alipay.sofa.rpc.codec.AbstractSerializer;
+import com.alipay.sofa.rpc.codec.common.BlackAndWhiteListFileLoader;
import com.alipay.sofa.rpc.codec.sofahessian.serialize.CustomHessianSerializer;
import com.alipay.sofa.rpc.codec.sofahessian.serialize.SofaRequestHessianSerializer;
import com.alipay.sofa.rpc.codec.sofahessian.serialize.SofaResponseHessianSerializer;
@@ -95,7 +96,7 @@ public SofaHessianSerializer() {
if (RpcConfigs.getBooleanValue(RpcOptions.SERIALIZE_BLACKLIST_ENABLE) &&
SofaConfigs.getBooleanValue(SofaOptions.CONFIG_SERIALIZE_BLACKLIST, true)) {
ClassNameResolver resolver = new ClassNameResolver();
- resolver.addFilter(new NameBlackListFilter(BlackListFileLoader.SOFA_SERIALIZE_BLACK_LIST, 8192));
+ resolver.addFilter(new NameBlackListFilter(BlackAndWhiteListFileLoader.SOFA_SERIALIZE_BLACK_LIST, 8192));
serializerFactory.setClassNameResolver(resolver);
genericSerializerFactory.setClassNameResolver(resolver);
} else {
diff --git a/codec/codec-sofa-hessian/src/test/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoaderTest.java b/codec/codec-sofa-hessian/src/test/java/com/alipay/sofa/rpc/codec/sofahessian/BlackAndWhiteListFileLoaderTest.java
similarity index 71%
rename from codec/codec-sofa-hessian/src/test/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoaderTest.java
rename to codec/codec-sofa-hessian/src/test/java/com/alipay/sofa/rpc/codec/sofahessian/BlackAndWhiteListFileLoaderTest.java
index df934b6a1..05d279e4f 100644
--- a/codec/codec-sofa-hessian/src/test/java/com/alipay/sofa/rpc/codec/sofahessian/BlackListFileLoaderTest.java
+++ b/codec/codec-sofa-hessian/src/test/java/com/alipay/sofa/rpc/codec/sofahessian/BlackAndWhiteListFileLoaderTest.java
@@ -17,6 +17,7 @@
package com.alipay.sofa.rpc.codec.sofahessian;
import com.alipay.hessian.NameBlackListFilter;
+import com.alipay.sofa.rpc.codec.common.BlackAndWhiteListFileLoader;
import com.alipay.sofa.rpc.common.SofaOptions;
import org.junit.Assert;
import org.junit.Test;
@@ -29,17 +30,17 @@
*
* @author GengZhang
*/
-public class BlackListFileLoaderTest {
+public class BlackAndWhiteListFileLoaderTest {
@Test
public void testAll() throws Exception {
- List blacks = BlackListFileLoader.SOFA_SERIALIZE_BLACK_LIST;
+ List blacks = BlackAndWhiteListFileLoader.SOFA_SERIALIZE_BLACK_LIST;
Assert.assertNotNull(blacks);
String s = System.getProperty(SofaOptions.CONFIG_SERIALIZE_BLACKLIST_OVERRIDE);
try {
System.setProperty(SofaOptions.CONFIG_SERIALIZE_BLACKLIST_OVERRIDE, "-java.net.Socket");
- blacks = BlackListFileLoader.loadFile("/sofa-rpc/serialize_blacklist.txt");
+ blacks = BlackAndWhiteListFileLoader.loadBlackListFile("/sofa-rpc/serialize_blacklist.txt");
} finally {
if (s != null) {
System.setProperty(SofaOptions.CONFIG_SERIALIZE_BLACKLIST_OVERRIDE, s);
@@ -69,51 +70,51 @@ public void testAll() throws Exception {
@Test
public void overrideBlackList() {
List origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "-*");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "-*");
Assert.assertTrue(origin.size() == 0);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "!*");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "!*");
Assert.assertTrue(origin.size() == 0);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "-default");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "-default");
Assert.assertTrue(origin.size() == 0);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "!default");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "!default");
Assert.assertTrue(origin.size() == 0);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "-*,-com.xxx");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "-*,-com.xxx");
Assert.assertTrue(origin.size() == 0);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "aaa,-*,-com.xxx");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "aaa,-*,-com.xxx");
Assert.assertTrue(origin.size() == 1);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "-*,aaa");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "-*,aaa");
Assert.assertTrue(origin.size() == 1);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "-com.xxx");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "-com.xxx");
Assert.assertTrue(origin.size() == 2);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "-com.xxx,-com.yyy");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "-com.xxx,-com.yyy");
Assert.assertTrue(origin.size() == 1);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "com.xxx,-com.yyy");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "com.xxx,-com.yyy");
Assert.assertTrue(origin.size() == 2);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "com.aaa,-com.yyy");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "com.aaa,-com.yyy");
Assert.assertTrue(origin.size() == 3);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "com.aaa");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "com.aaa");
Assert.assertTrue(origin.size() == 4);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "com.xxx;com.yyy;com.zzz");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "com.xxx;com.yyy;com.zzz");
Assert.assertTrue(origin.size() == 3);
origin = buildOriginList();
- BlackListFileLoader.overrideBlackList(origin, "com.aaa,com.bbb,com.ccc");
+ BlackAndWhiteListFileLoader.overrideBlackList(origin, "com.aaa,com.bbb,com.ccc");
Assert.assertTrue(origin.size() == 6);
}
diff --git a/codec/pom.xml b/codec/pom.xml
index 2ca5db8c2..25814b811 100644
--- a/codec/pom.xml
+++ b/codec/pom.xml
@@ -20,6 +20,7 @@
codec-protostuff
codec-sofa-hessian
codec-msgpack
+ codec-sofa-fury
diff --git a/core/api/src/main/java/com/alipay/sofa/rpc/codec/AbstractSerializer.java b/core/api/src/main/java/com/alipay/sofa/rpc/codec/AbstractSerializer.java
index 0b9ebc0eb..efe20c953 100644
--- a/core/api/src/main/java/com/alipay/sofa/rpc/codec/AbstractSerializer.java
+++ b/core/api/src/main/java/com/alipay/sofa/rpc/codec/AbstractSerializer.java
@@ -33,6 +33,8 @@ public abstract class AbstractSerializer implements Serializer {
protected static Map genericServiceMap = new ConcurrentHashMap<>();
+ protected Map customSerializers = new ConcurrentHashMap<>();
+
protected SofaRpcException buildSerializeError(String message) {
return new SofaRpcException(getErrorCode(true), LogCodes.getLog(LogCodes.ERROR_SERIALIZER, message));
}
@@ -73,4 +75,19 @@ public static void registerGenericService(String serviceName, String className)
public static void clear() {
genericServiceMap.clear();
}
+
+ protected CustomSerializer getObjCustomSerializer(Object obj) {
+ if (obj == null) {
+ return null;
+ }
+ return getSerializer(obj.getClass());
+ }
+
+ protected CustomSerializer getSerializer(Class clazz) {
+ return customSerializers.get(clazz);
+ }
+
+ protected void addSerializer(Class clazz, CustomSerializer serializerManager) {
+ customSerializers.put(clazz, serializerManager);
+ }
}
diff --git a/core/api/src/main/java/com/alipay/sofa/rpc/codec/CustomSerializer.java b/core/api/src/main/java/com/alipay/sofa/rpc/codec/CustomSerializer.java
new file mode 100644
index 000000000..42a4f6398
--- /dev/null
+++ b/core/api/src/main/java/com/alipay/sofa/rpc/codec/CustomSerializer.java
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.rpc.codec;
+
+import com.alipay.sofa.rpc.core.exception.SofaRpcException;
+import com.alipay.sofa.rpc.transport.AbstractByteBuf;
+
+import java.util.Map;
+
+/**
+ * @author leizhiyuan
+ */
+public interface CustomSerializer {
+
+ /**
+ * 序列化
+ *
+ * @param object 对象
+ * @param context 上下文
+ * @return 序列化后的对象
+ * @throws SofaRpcException 序列化异常
+ */
+ public AbstractByteBuf encodeObject(T object, Map context) throws SofaRpcException;
+
+ /**
+ * 反序列化,只有类型,返回对象
+ *
+ * @param data 原始字节数组
+ * @param context 上下文
+ * @return 反序列化后的对象
+ * @throws SofaRpcException 序列化异常
+ */
+ public T decodeObject(AbstractByteBuf data, Map context) throws SofaRpcException;
+
+ /**
+ * 反序列化,已有数据,填充字段
+ *
+ * @param data 原始字节数组
+ * @param template 模板对象
+ * @param context 上下文
+ * @throws SofaRpcException 序列化异常
+ */
+ public void decodeObjectByTemplate(AbstractByteBuf data, Map context, T template)
+ throws SofaRpcException;
+
+}
\ No newline at end of file
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 aba59c9fb..7e51652d2 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
@@ -27,16 +27,16 @@ public final class Version {
/**
* 当前RPC版本,例如:5.6.7
*/
- public static final String VERSION = "5.10.1";
+ public static final String VERSION = "5.11.1";
/**
* 当前RPC版本,例如: 5.6.7 对应 50607
*/
- public static final int RPC_VERSION = 51001;
+ public static final int RPC_VERSION = 51101;
/**
* 当前Build版本,每次发布修改
*/
- public static final String BUILD_VERSION = "5.10.1_20230615171852";
+ public static final String BUILD_VERSION = "5.11.1_20230911155412";
}
diff --git a/core/api/src/main/java/com/alipay/sofa/rpc/ext/ExtensionLoader.java b/core/api/src/main/java/com/alipay/sofa/rpc/ext/ExtensionLoader.java
index 8deb9200f..0e36f2365 100644
--- a/core/api/src/main/java/com/alipay/sofa/rpc/ext/ExtensionLoader.java
+++ b/core/api/src/main/java/com/alipay/sofa/rpc/ext/ExtensionLoader.java
@@ -34,6 +34,7 @@
import java.io.InputStreamReader;
import java.lang.reflect.Modifier;
import java.net.URL;
+import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
@@ -184,7 +185,7 @@ protected void loadFromClassLoader(ClassLoader classLoader, String fullFileName)
}
BufferedReader reader = null;
try {
- reader = new BufferedReader(new InputStreamReader(url.openStream(), "UTF-8"));
+ reader = new BufferedReader(new InputStreamReader(url.openStream(), StandardCharsets.UTF_8));
String line;
while ((line = reader.readLine()) != null) {
readLine(url, line);
diff --git a/core/common/src/main/java/com/alipay/sofa/rpc/common/SofaOptions.java b/core/common/src/main/java/com/alipay/sofa/rpc/common/SofaOptions.java
index ae46681d5..4a9e1753c 100644
--- a/core/common/src/main/java/com/alipay/sofa/rpc/common/SofaOptions.java
+++ b/core/common/src/main/java/com/alipay/sofa/rpc/common/SofaOptions.java
@@ -160,6 +160,10 @@ public class SofaOptions {
* 序列化覆盖
*/
public static final String CONFIG_SERIALIZE_BLACKLIST_OVERRIDE = "rpc_serialize_blacklist_override";
+ /**
+ * 序列化覆盖
+ */
+ public static final String CONFIG_SERIALIZE_WHITELIST_OVERRIDE = "rpc_serialize_whitelist_override";
//========= GRPC 相关配置 ==========
/**
diff --git a/core/common/src/main/java/com/alipay/sofa/rpc/common/config/RpcConfigKeys.java b/core/common/src/main/java/com/alipay/sofa/rpc/common/config/RpcConfigKeys.java
index 11fc481c5..bba581abf 100644
--- a/core/common/src/main/java/com/alipay/sofa/rpc/common/config/RpcConfigKeys.java
+++ b/core/common/src/main/java/com/alipay/sofa/rpc/common/config/RpcConfigKeys.java
@@ -18,6 +18,9 @@
import com.alipay.sofa.common.config.ConfigKey;
+import static com.alipay.sofa.rpc.common.SofaOptions.CONFIG_SERIALIZE_BLACKLIST_OVERRIDE;
+import static com.alipay.sofa.rpc.common.SofaOptions.CONFIG_SERIALIZE_WHITELIST_OVERRIDE;
+
/**
* @author zhaowang
* @version : RpcConfigKeys.java, v 0.1 2020年12月14日 9:56 下午 zhaowang Exp $
@@ -102,4 +105,29 @@ public class RpcConfigKeys {
false,
"judge the generic object exception fields.",
new String[] { "sofa_rpc_generic_exception_fields" });
+
+ public static final ConfigKey SERIALIZE_BLACKLIST_OVERRIDE = ConfigKey
+ .build(
+ "sofa.rpc.serialize.blacklist.override",
+ "",
+ false,
+ "Additional serialization blacklist.",
+ new String[] { CONFIG_SERIALIZE_BLACKLIST_OVERRIDE });
+
+ public static final ConfigKey SERIALIZE_WHITELIST_OVERRIDE = ConfigKey
+ .build(
+ "sofa.rpc.serialize.whitelist.override",
+ "",
+ false,
+ "Additional serialization whitelist.",
+ new String[] { CONFIG_SERIALIZE_WHITELIST_OVERRIDE });
+
+ public static final ConfigKey SERIALIZE_CHECKER_MODE = ConfigKey
+ .build(
+ "sofa.rpc.codec.serialize.checkMode",
+ "STRICT",
+ true,
+ " The default filtering mode is STRICT.You can also set WARN or DISABLE",
+ new String[] { "sofa_rpc_codec_serialize_checkMode" });
+
}
diff --git a/core/common/src/main/resources/com/alipay/sofa/rpc/common/rpc-config-default.json b/core/common/src/main/resources/com/alipay/sofa/rpc/common/rpc-config-default.json
index 9becfcf3f..6ad8f836f 100644
--- a/core/common/src/main/resources/com/alipay/sofa/rpc/common/rpc-config-default.json
+++ b/core/common/src/main/resources/com/alipay/sofa/rpc/common/rpc-config-default.json
@@ -17,7 +17,7 @@ PS:大家也看到了,本JSON文档是支持注释的,而标准JSON是不支
"META-INF/services/"
],
// 需要被加载的模块列表,多个用逗号隔开
- "module.load.list" : "*",
+ "module.load.list": "*",
/*-------------RPC框架内部使用配置项-------------*/
diff --git a/example/pom.xml b/example/pom.xml
index 6a8ff6b58..4cf8c712c 100644
--- a/example/pom.xml
+++ b/example/pom.xml
@@ -11,10 +11,10 @@
- 3.11.0
- 1.17.0
+ 3.22.0
+ 1.53.0
0.0.3
- 1.33.1
+ 1.53.0
3.7.0
@@ -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
@@ -194,7 +199,7 @@
protobuf-maven-plugin
0.5.1
- com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}
+ com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
grpc-java
io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
build/generated/source/proto/main/java
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 cb1c8499d..57e7f943e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -77,7 +77,7 @@
- 5.10.1
+ 5.11.1
1.33
true
true
@@ -87,8 +87,8 @@
1.8
utf-8
false
- 3.7.1
- 1.27.2
+ 3.22.0
+ 1.53.0
0.0.2
diff --git a/registry/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/DomainRegistry.java b/registry/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/DomainRegistry.java
index d6cc90ae6..4b94f72b1 100644
--- a/registry/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/DomainRegistry.java
+++ b/registry/registry-local/src/main/java/com/alipay/sofa/rpc/registry/local/DomainRegistry.java
@@ -118,7 +118,7 @@ protected void refreshDomain() {
}
for (String directUrl : keySet) {
- ProviderInfo providerInfo = ProviderHelper.toProviderInfo(directUrl);
+ ProviderInfo providerInfo = convertToProviderInfo(directUrl);
List result = directUrl2IpUrl(providerInfo, domainCache.get(directUrl));
domainCache.put(directUrl, result);
}
diff --git a/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshApiClientTest.java b/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshApiClientTest.java
index 4f57ab30b..5b97d8b19 100644
--- a/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshApiClientTest.java
+++ b/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshApiClientTest.java
@@ -57,7 +57,7 @@ public void testApplicationInfo() {
public void before() {
httpMockServer = new HttpMockServer();
- meshApiClient = new MeshApiClient("http://localhost:7654");
+ meshApiClient = new MeshApiClient("http://127.0.0.1:7654");
httpMockServer.initSever(7654);
ApplicationInfoResult applicationInfoResult = new ApplicationInfoResult();
diff --git a/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshRegistryTest.java b/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshRegistryTest.java
index f6a4c595d..ca478aa54 100644
--- a/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshRegistryTest.java
+++ b/registry/registry-mesh/src/test/java/com/alipay/sofa/rpc/registry/mesh/MeshRegistryTest.java
@@ -95,7 +95,7 @@ public void setUp() {
.setProtocol("mesh")
.setSubscribe(true)
.setRegister(true)
- .setAddress("http://localhost:7654");
+ .setAddress("http://127.0.0.1:7654");
registry = (MeshRegistry) RegistryFactory.getRegistry(registryConfig);
registry.init();
diff --git a/registry/registry-nacos/pom.xml b/registry/registry-nacos/pom.xml
index ca82a7e22..c653c76d2 100644
--- a/registry/registry-nacos/pom.xml
+++ b/registry/registry-nacos/pom.xml
@@ -37,9 +37,13 @@
name.jervyshi
nacos-embedded
- 0.2.0
+ 0.3.0
test
+
+ commons-io
+ commons-io
+
diff --git a/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/NacosRegistryTest.java b/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/NacosRegistryTest.java
index e39923f8d..373af0eb6 100644
--- a/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/NacosRegistryTest.java
+++ b/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/NacosRegistryTest.java
@@ -81,7 +81,7 @@ public void tearDown() {
}
/**
- * 测试Zookeeper Provider Observer
+ * 测试 Nacos Provider Observer
*
* @throws Exception the exception
*/
@@ -93,21 +93,21 @@ public void testProviderObserver() throws Exception {
TimeUnit.SECONDS.sleep(10);
serverConfig = new ServerConfig()
- .setProtocol("bolt")
- .setHost("0.0.0.0")
- .setPort(12200);
+ .setProtocol("bolt")
+ .setHost("0.0.0.0")
+ .setPort(12200);
ProviderConfig> provider = new ProviderConfig();
provider.setInterfaceId("com.alipay.xxx.NacosTestService")
- .setApplication(new ApplicationConfig().setAppName("test-server"))
- .setUniqueId("nacos-test")
- .setProxy("javassist")
- .setRegister(true)
- .setRegistry(registryConfig)
- .setSerialization("hessian2")
- .setServer(serverConfig)
- .setWeight(222)
- .setTimeout(3000);
+ .setApplication(new ApplicationConfig().setAppName("test-server"))
+ .setUniqueId("nacos-test")
+ .setProxy("javassist")
+ .setRegister(true)
+ .setRegistry(registryConfig)
+ .setSerialization("hessian2")
+ .setServer(serverConfig)
+ .setWeight(222)
+ .setTimeout(3000);
// 注册
try {
@@ -120,13 +120,13 @@ public void testProviderObserver() throws Exception {
ConsumerConfig> consumer = new ConsumerConfig();
consumer.setInterfaceId("com.alipay.xxx.NacosTestService")
- .setApplication(new ApplicationConfig().setAppName("test-server"))
- .setUniqueId("nacos-test")
- .setProxy("javassist")
- .setSubscribe(true)
- .setSerialization("java")
- .setInvokeType("sync")
- .setTimeout(4444);
+ .setApplication(new ApplicationConfig().setAppName("test-server"))
+ .setUniqueId("nacos-test")
+ .setProxy("javassist")
+ .setSubscribe(true)
+ .setSerialization("java")
+ .setInvokeType("sync")
+ .setTimeout(4444);
// 订阅
CountDownLatch latch = new CountDownLatch(1);
@@ -144,12 +144,12 @@ public void testProviderObserver() throws Exception {
// 订阅 错误的uniqueId
ConsumerConfig> consumerNoUniqueId = new ConsumerConfig();
consumerNoUniqueId.setInterfaceId("com.alipay.xxx.NacosTestService")
- .setApplication(new ApplicationConfig().setAppName("test-server"))
- .setProxy("javassist")
- .setSubscribe(true)
- .setSerialization("java")
- .setInvokeType("sync")
- .setTimeout(4444);
+ .setApplication(new ApplicationConfig().setAppName("test-server"))
+ .setProxy("javassist")
+ .setSubscribe(true)
+ .setSerialization("java")
+ .setInvokeType("sync")
+ .setTimeout(4444);
latch = new CountDownLatch(1);
MockProviderInfoListener wrongProviderInfoListener = new MockProviderInfoListener();
wrongProviderInfoListener.setCountDownLatch(latch);
@@ -174,9 +174,9 @@ public void testProviderObserver() throws Exception {
latch = new CountDownLatch(2);
providerInfoListener.setCountDownLatch(latch);
provider.getServer().add(new ServerConfig()
- .setProtocol("bolt")
- .setHost("0.0.0.0")
- .setPort(12201));
+ .setProtocol("bolt")
+ .setHost("0.0.0.0")
+ .setPort(12201));
registry.register(provider);
latch.await(timeoutPerSub * 2, TimeUnit.MILLISECONDS);
@@ -189,13 +189,13 @@ public void testProviderObserver() throws Exception {
// 重复订阅
ConsumerConfig> consumer2 = new ConsumerConfig();
consumer2.setInterfaceId("com.alipay.xxx.NacosTestService")
- .setUniqueId("nacos-test")
- .setApplication(new ApplicationConfig().setAppName("test-server"))
- .setProxy("javassist")
- .setSubscribe(true)
- .setSerialization("java")
- .setInvokeType("sync")
- .setTimeout(4444);
+ .setUniqueId("nacos-test")
+ .setApplication(new ApplicationConfig().setAppName("test-server"))
+ .setProxy("javassist")
+ .setSubscribe(true)
+ .setSerialization("java")
+ .setInvokeType("sync")
+ .setTimeout(4444);
CountDownLatch latch2 = new CountDownLatch(1);
MockProviderInfoListener providerInfoListener2 = new MockProviderInfoListener();
providerInfoListener2.setCountDownLatch(latch2);
@@ -214,17 +214,17 @@ public void testProviderObserver() throws Exception {
// 批量反注册,判断订阅者2的数据
latch = new CountDownLatch(2);
providerInfoListener2.setCountDownLatch(latch);
- List providerConfigList = new ArrayList();
+ List providerConfigList = new ArrayList<>();
providerConfigList.add(provider);
registry.batchUnRegister(providerConfigList);
latch.await(timeoutPerSub * 2, TimeUnit.MILLISECONDS);
- Assert.assertEquals("after unregister: 1", 1, ps2.size());
+ Assert.assertEquals("after unregister: 0", 0, ps2.size()); // 所有的 Provider 都已经反向注册了,应该是 0
LOGGER.info("after unregister consumer, and consumer2 {}", ps);
// 批量取消订阅
- List consumerConfigList = new ArrayList();
+ List consumerConfigList = new ArrayList<>();
consumerConfigList.add(consumer2);
registry.batchUnSubscribe(consumerConfigList);
}
diff --git a/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/base/BaseNacosTest.java b/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/base/BaseNacosTest.java
index 8266b34a9..ec9f6d1e2 100644
--- a/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/base/BaseNacosTest.java
+++ b/registry/registry-nacos/src/test/java/com/alipay/sofa/rpc/registry/nacos/base/BaseNacosTest.java
@@ -60,7 +60,7 @@ public static void adAfterClass() {
@Before
public void setup() {
//see https://nacos.io/zh-cn/docs/2.0.0-compatibility.html
- nacosProcess = NacosStarterBuilder.nacosStarter().withServerPort(8848).withNacosVersion("2.0.3").build()
+ nacosProcess = NacosStarterBuilder.nacosStarter().withServerPort(8848).withNacosVersion("2.2.3").build()
.start();
}
diff --git a/registry/registry-sofa/pom.xml b/registry/registry-sofa/pom.xml
index 915299d13..f1427cb07 100644
--- a/registry/registry-sofa/pom.xml
+++ b/registry/registry-sofa/pom.xml
@@ -12,7 +12,7 @@
sofa-rpc-registry-sofa
- 5.2.0
+ 6.3.0
-Dnetwork_interface_denylist=docker0
@@ -66,14 +66,6 @@
log4j-jcl
org.apache.logging.log4j
-
- log4j-core
- org.apache.logging.log4j
-
-
- log4j-api
- org.apache.logging.log4j
-
@@ -81,6 +73,11 @@
junit
test
+
+ io.prometheus
+ simpleclient_hotspot
+ test
+
diff --git a/registry/registry-sofa/src/test/java/com/alipay/sofa/common/profile/StringUtil.java b/registry/registry-sofa/src/test/java/com/alipay/sofa/common/profile/StringUtil.java
new file mode 100644
index 000000000..26475fc3a
--- /dev/null
+++ b/registry/registry-sofa/src/test/java/com/alipay/sofa/common/profile/StringUtil.java
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.alipay.sofa.common.profile;
+
+/**
+ * @author khotyn
+ * @version StringUtil.java, v 0.1 2023年07月05日 14:40 khotyn
+ */
+public class StringUtil {
+ public static boolean equals(String str1, String str2) {
+ return str1 == null ? str2 == null : str1.equals(str2);
+ }
+
+ public static boolean isNotEmpty(String str) {
+ return str != null && str.length() > 0;
+ }
+
+ public static boolean isNotBlank(String str) {
+ int length;
+ if (str != null && (length = str.length()) != 0) {
+ for (int i = 0; i < length; ++i) {
+ if (!Character.isWhitespace(str.charAt(i))) {
+ return true;
+ }
+ }
+
+ return false;
+ } else {
+ return false;
+ }
+ }
+
+ public static boolean isBlank(String str) {
+ int length;
+ if (str != null && (length = str.length()) != 0) {
+ for (int i = 0; i < length; ++i) {
+ if (!Character.isWhitespace(str.charAt(i))) {
+ return false;
+ }
+ }
+
+ return true;
+ } else {
+ return true;
+ }
+ }
+}
\ No newline at end of file
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/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericProto.java b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericProto.java
index 28601cbe1..808f3a3a7 100644
--- a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericProto.java
+++ b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericProto.java
@@ -40,18 +40,10 @@ public static void registerAllExtensions(
"ervice\022 \n\007generic\022\010.Request\032\t.Response\"\000" +
"B\030\n\006tripleB\014GenericProtoP\001b\006proto3"
};
- com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
- new com.google.protobuf.Descriptors.FileDescriptor. InternalDescriptorAssigner() {
- public com.google.protobuf.ExtensionRegistry assignDescriptors(
- com.google.protobuf.Descriptors.FileDescriptor root) {
- descriptor = root;
- return null;
- }
- };
- com.google.protobuf.Descriptors.FileDescriptor
+ descriptor = com.google.protobuf.Descriptors.FileDescriptor
.internalBuildGeneratedFileFrom(descriptorData,
new com.google.protobuf.Descriptors.FileDescriptor[] {
- }, assigner);
+ });
internal_static_Request_descriptor =
getDescriptor().getMessageTypes().get(0);
internal_static_Request_fieldAccessorTable = new
diff --git a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericServiceGrpc.java b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericServiceGrpc.java
index c23d3c0ea..75a2e5ba5 100644
--- a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericServiceGrpc.java
+++ b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/GenericServiceGrpc.java
@@ -1,25 +1,13 @@
package triple;
import static io.grpc.MethodDescriptor.generateFullMethodName;
-import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
-import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
-import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
-import static io.grpc.stub.ClientCalls.asyncUnaryCall;
-import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
-import static io.grpc.stub.ClientCalls.blockingUnaryCall;
-import static io.grpc.stub.ClientCalls.futureUnaryCall;
-import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
-import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
-import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
-import static io.grpc.stub.ServerCalls.asyncUnaryCall;
-import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
-import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
*/
@javax.annotation.Generated(
- value = "by gRPC proto compiler (version 1.27.2)",
+ value = "by gRPC proto compiler (version 1.53.0)",
comments = "Source: transformer.proto")
+@io.grpc.stub.annotations.GrpcGenerated
public final class GenericServiceGrpc {
private GenericServiceGrpc() {}
@@ -110,14 +98,14 @@ public static abstract class GenericServiceImplBase implements io.grpc.BindableS
*/
public void generic(triple.Request request,
io.grpc.stub.StreamObserver responseObserver) {
- asyncUnimplementedUnaryCall(getGenericMethod(), responseObserver);
+ io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getGenericMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getGenericMethod(),
- asyncUnaryCall(
+ io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
triple.Request,
triple.Response>(
@@ -144,7 +132,7 @@ protected GenericServiceStub build(
*/
public void generic(triple.Request request,
io.grpc.stub.StreamObserver responseObserver) {
- asyncUnaryCall(
+ io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getGenericMethod(), getCallOptions()), request, responseObserver);
}
}
@@ -166,7 +154,7 @@ protected GenericServiceBlockingStub build(
/**
*/
public triple.Response generic(triple.Request request) {
- return blockingUnaryCall(
+ return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getGenericMethod(), getCallOptions(), request);
}
}
@@ -189,7 +177,7 @@ protected GenericServiceFutureStub build(
*/
public com.google.common.util.concurrent.ListenableFuture generic(
triple.Request request) {
- return futureUnaryCall(
+ return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getGenericMethod(), getCallOptions()), request);
}
}
diff --git a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Request.java b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Request.java
index d32e467a4..f2c62638a 100644
--- a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Request.java
+++ b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Request.java
@@ -6,7 +6,7 @@
/**
* Protobuf type {@code Request}
*/
-public final class Request extends
+public final class Request extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:Request)
RequestOrBuilder {
@@ -18,81 +18,17 @@ private Request(com.google.protobuf.GeneratedMessageV3.Builder> builder) {
private Request() {
serializeType_ = "";
args_ = java.util.Collections.emptyList();
- argTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ argTypes_ =
+ com.google.protobuf.LazyStringArrayList.emptyList();
}
@java.lang.Override
- public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
- return this.unknownFields;
- }
- private Request(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- this();
- if (extensionRegistry == null) {
- throw new java.lang.NullPointerException();
- }
- int mutable_bitField0_ = 0;
- com.google.protobuf.UnknownFieldSet.Builder unknownFields =
- com.google.protobuf.UnknownFieldSet.newBuilder();
- try {
- boolean done = false;
- while (!done) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- done = true;
- break;
- case 10: {
- java.lang.String s = input.readStringRequireUtf8();
-
- serializeType_ = s;
- break;
- }
- case 18: {
- if (!((mutable_bitField0_ & 0x00000002) != 0)) {
- args_ = new java.util.ArrayList();
- mutable_bitField0_ |= 0x00000002;
- }
- args_.add(input.readBytes());
- break;
- }
- case 26: {
- java.lang.String s = input.readStringRequireUtf8();
- if (!((mutable_bitField0_ & 0x00000004) != 0)) {
- argTypes_ = new com.google.protobuf.LazyStringArrayList();
- mutable_bitField0_ |= 0x00000004;
- }
- argTypes_.add(s);
- break;
- }
- default: {
- if (!parseUnknownField(
- input, unknownFields, extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
- }
- }
- } catch (com.google.protobuf.InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(this);
- } catch (java.io.IOException e) {
- throw new com.google.protobuf.InvalidProtocolBufferException(
- e).setUnfinishedMessage(this);
- } finally {
- if (((mutable_bitField0_ & 0x00000002) != 0)) {
- args_ = java.util.Collections.unmodifiableList(args_); // C
- }
- if (((mutable_bitField0_ & 0x00000004) != 0)) {
- argTypes_ = argTypes_.getUnmodifiableView();
- }
- this.unknownFields = unknownFields.build();
- makeExtensionsImmutable();
- }
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new Request();
}
+
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return triple.GenericProto.internal_static_Request_descriptor;
@@ -106,12 +42,14 @@ private Request(
triple.Request.class, triple.Request.Builder.class);
}
- private int bitField0_;
public static final int SERIALIZETYPE_FIELD_NUMBER = 1;
- private volatile java.lang.Object serializeType_;
+ @SuppressWarnings("serial")
+ private volatile java.lang.Object serializeType_ = "";
/**
* string serializeType = 1;
+ * @return The serializeType.
*/
+ @java.lang.Override
public java.lang.String getSerializeType() {
java.lang.Object ref = serializeType_;
if (ref instanceof java.lang.String) {
@@ -126,7 +64,9 @@ public java.lang.String getSerializeType() {
}
/**
* string serializeType = 1;
+ * @return The bytes for serializeType.
*/
+ @java.lang.Override
public com.google.protobuf.ByteString
getSerializeTypeBytes() {
java.lang.Object ref = serializeType_;
@@ -142,31 +82,40 @@ public java.lang.String getSerializeType() {
}
public static final int ARGS_FIELD_NUMBER = 2;
+ @SuppressWarnings("serial")
private java.util.List args_;
/**
* repeated bytes args = 2;
+ * @return A list containing the args.
*/
+ @java.lang.Override
public java.util.List
getArgsList() {
return args_;
}
/**
* repeated bytes args = 2;
+ * @return The count of args.
*/
public int getArgsCount() {
return args_.size();
}
/**
* repeated bytes args = 2;
+ * @param index The index of the element to return.
+ * @return The args at the given index.
*/
public com.google.protobuf.ByteString getArgs(int index) {
return args_.get(index);
}
public static final int ARGTYPES_FIELD_NUMBER = 3;
- private com.google.protobuf.LazyStringList argTypes_;
+ @SuppressWarnings("serial")
+ private com.google.protobuf.LazyStringArrayList argTypes_ =
+ com.google.protobuf.LazyStringArrayList.emptyList();
/**
* repeated string argTypes = 3;
+ * @return A list containing the argTypes.
*/
public com.google.protobuf.ProtocolStringList
getArgTypesList() {
@@ -174,18 +123,23 @@ public com.google.protobuf.ByteString getArgs(int index) {
}
/**
* repeated string argTypes = 3;
+ * @return The count of argTypes.
*/
public int getArgTypesCount() {
return argTypes_.size();
}
/**
* repeated string argTypes = 3;
+ * @param index The index of the element to return.
+ * @return The argTypes at the given index.
*/
public java.lang.String getArgTypes(int index) {
return argTypes_.get(index);
}
/**
* repeated string argTypes = 3;
+ * @param index The index of the value to return.
+ * @return The bytes of the argTypes at the given index.
*/
public com.google.protobuf.ByteString
getArgTypesBytes(int index) {
@@ -206,7 +160,7 @@ public final boolean isInitialized() {
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- if (!getSerializeTypeBytes().isEmpty()) {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serializeType_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, serializeType_);
}
for (int i = 0; i < args_.size(); i++) {
@@ -215,7 +169,7 @@ public void writeTo(com.google.protobuf.CodedOutputStream output)
for (int i = 0; i < argTypes_.size(); i++) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, argTypes_.getRaw(i));
}
- unknownFields.writeTo(output);
+ getUnknownFields().writeTo(output);
}
@java.lang.Override
@@ -224,7 +178,7 @@ public int getSerializedSize() {
if (size != -1) return size;
size = 0;
- if (!getSerializeTypeBytes().isEmpty()) {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serializeType_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, serializeType_);
}
{
@@ -244,7 +198,7 @@ public int getSerializedSize() {
size += dataSize;
size += 1 * getArgTypesList().size();
}
- size += unknownFields.getSerializedSize();
+ size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@@ -265,7 +219,7 @@ public boolean equals(final java.lang.Object obj) {
.equals(other.getArgsList())) return false;
if (!getArgTypesList()
.equals(other.getArgTypesList())) return false;
- if (!unknownFields.equals(other.unknownFields)) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -286,7 +240,7 @@ public int hashCode() {
hash = (37 * hash) + ARGTYPES_FIELD_NUMBER;
hash = (53 * hash) + getArgTypesList().hashCode();
}
- hash = (29 * hash) + unknownFields.hashCode();
+ hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
@@ -403,28 +357,22 @@ public static final class Builder extends
// Construct using triple.Request.newBuilder()
private Builder() {
- maybeForceBuilderInitialization();
+
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
- maybeForceBuilderInitialization();
- }
- private void maybeForceBuilderInitialization() {
- if (com.google.protobuf.GeneratedMessageV3
- .alwaysUseFieldBuilders) {
- }
+
}
@java.lang.Override
public Builder clear() {
super.clear();
+ bitField0_ = 0;
serializeType_ = "";
-
args_ = java.util.Collections.emptyList();
- bitField0_ = (bitField0_ & ~0x00000002);
- argTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- bitField0_ = (bitField0_ & ~0x00000004);
+ argTypes_ =
+ com.google.protobuf.LazyStringArrayList.emptyList();
return this;
}
@@ -451,56 +399,31 @@ public triple.Request build() {
@java.lang.Override
public triple.Request buildPartial() {
triple.Request result = new triple.Request(this);
- int from_bitField0_ = bitField0_;
- int to_bitField0_ = 0;
- result.serializeType_ = serializeType_;
+ buildPartialRepeatedFields(result);
+ if (bitField0_ != 0) { buildPartial0(result); }
+ onBuilt();
+ return result;
+ }
+
+ private void buildPartialRepeatedFields(triple.Request result) {
if (((bitField0_ & 0x00000002) != 0)) {
args_ = java.util.Collections.unmodifiableList(args_);
bitField0_ = (bitField0_ & ~0x00000002);
}
result.args_ = args_;
- if (((bitField0_ & 0x00000004) != 0)) {
- argTypes_ = argTypes_.getUnmodifiableView();
- bitField0_ = (bitField0_ & ~0x00000004);
- }
- result.argTypes_ = argTypes_;
- result.bitField0_ = to_bitField0_;
- onBuilt();
- return result;
}
- @java.lang.Override
- public Builder clone() {
- return super.clone();
- }
- @java.lang.Override
- public Builder setField(
- com.google.protobuf.Descriptors.FieldDescriptor field,
- java.lang.Object value) {
- return super.setField(field, value);
- }
- @java.lang.Override
- public Builder clearField(
- com.google.protobuf.Descriptors.FieldDescriptor field) {
- return super.clearField(field);
- }
- @java.lang.Override
- public Builder clearOneof(
- com.google.protobuf.Descriptors.OneofDescriptor oneof) {
- return super.clearOneof(oneof);
- }
- @java.lang.Override
- public Builder setRepeatedField(
- com.google.protobuf.Descriptors.FieldDescriptor field,
- int index, java.lang.Object value) {
- return super.setRepeatedField(field, index, value);
- }
- @java.lang.Override
- public Builder addRepeatedField(
- com.google.protobuf.Descriptors.FieldDescriptor field,
- java.lang.Object value) {
- return super.addRepeatedField(field, value);
+ private void buildPartial0(triple.Request result) {
+ int from_bitField0_ = bitField0_;
+ if (((from_bitField0_ & 0x00000001) != 0)) {
+ result.serializeType_ = serializeType_;
+ }
+ if (((from_bitField0_ & 0x00000004) != 0)) {
+ argTypes_.makeImmutable();
+ result.argTypes_ = argTypes_;
+ }
}
+
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof triple.Request) {
@@ -515,6 +438,7 @@ public Builder mergeFrom(triple.Request other) {
if (other == triple.Request.getDefaultInstance()) return this;
if (!other.getSerializeType().isEmpty()) {
serializeType_ = other.serializeType_;
+ bitField0_ |= 0x00000001;
onChanged();
}
if (!other.args_.isEmpty()) {
@@ -530,14 +454,14 @@ public Builder mergeFrom(triple.Request other) {
if (!other.argTypes_.isEmpty()) {
if (argTypes_.isEmpty()) {
argTypes_ = other.argTypes_;
- bitField0_ = (bitField0_ & ~0x00000004);
+ bitField0_ |= 0x00000004;
} else {
ensureArgTypesIsMutable();
argTypes_.addAll(other.argTypes_);
}
onChanged();
}
- this.mergeUnknownFields(other.unknownFields);
+ this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@@ -552,17 +476,47 @@ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- triple.Request parsedMessage = null;
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
try {
- parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ serializeType_ = input.readStringRequireUtf8();
+ bitField0_ |= 0x00000001;
+ break;
+ } // case 10
+ case 18: {
+ com.google.protobuf.ByteString v = input.readBytes();
+ ensureArgsIsMutable();
+ args_.add(v);
+ break;
+ } // case 18
+ case 26: {
+ java.lang.String s = input.readStringRequireUtf8();
+ ensureArgTypesIsMutable();
+ argTypes_.add(s);
+ break;
+ } // case 26
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (triple.Request) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
- if (parsedMessage != null) {
- mergeFrom(parsedMessage);
- }
- }
+ onChanged();
+ } // finally
return this;
}
private int bitField0_;
@@ -570,6 +524,7 @@ public Builder mergeFrom(
private java.lang.Object serializeType_ = "";
/**
* string serializeType = 1;
+ * @return The serializeType.
*/
public java.lang.String getSerializeType() {
java.lang.Object ref = serializeType_;
@@ -585,6 +540,7 @@ public java.lang.String getSerializeType() {
}
/**
* string serializeType = 1;
+ * @return The bytes for serializeType.
*/
public com.google.protobuf.ByteString
getSerializeTypeBytes() {
@@ -601,37 +557,38 @@ public java.lang.String getSerializeType() {
}
/**
* string serializeType = 1;
+ * @param value The serializeType to set.
+ * @return This builder for chaining.
*/
public Builder setSerializeType(
java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
-
+ if (value == null) { throw new NullPointerException(); }
serializeType_ = value;
+ bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
* string serializeType = 1;
+ * @return This builder for chaining.
*/
public Builder clearSerializeType() {
-
serializeType_ = getDefaultInstance().getSerializeType();
+ bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
* string serializeType = 1;
+ * @param value The bytes for serializeType to set.
+ * @return This builder for chaining.
*/
public Builder setSerializeTypeBytes(
com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- checkByteStringIsUtf8(value);
-
+ if (value == null) { throw new NullPointerException(); }
+ checkByteStringIsUtf8(value);
serializeType_ = value;
+ bitField0_ |= 0x00000001;
onChanged();
return this;
}
@@ -641,10 +598,11 @@ private void ensureArgsIsMutable() {
if (!((bitField0_ & 0x00000002) != 0)) {
args_ = new java.util.ArrayList(args_);
bitField0_ |= 0x00000002;
- }
+ }
}
/**
* repeated bytes args = 2;
+ * @return A list containing the args.
*/
public java.util.List
getArgsList() {
@@ -653,43 +611,49 @@ private void ensureArgsIsMutable() {
}
/**
* repeated bytes args = 2;
+ * @return The count of args.
*/
public int getArgsCount() {
return args_.size();
}
/**
* repeated bytes args = 2;
+ * @param index The index of the element to return.
+ * @return The args at the given index.
*/
public com.google.protobuf.ByteString getArgs(int index) {
return args_.get(index);
}
/**
* repeated bytes args = 2;
+ * @param index The index to set the value at.
+ * @param value The args to set.
+ * @return This builder for chaining.
*/
public Builder setArgs(
int index, com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureArgsIsMutable();
+ if (value == null) { throw new NullPointerException(); }
+ ensureArgsIsMutable();
args_.set(index, value);
onChanged();
return this;
}
/**
* repeated bytes args = 2;
+ * @param value The args to add.
+ * @return This builder for chaining.
*/
public Builder addArgs(com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureArgsIsMutable();
+ if (value == null) { throw new NullPointerException(); }
+ ensureArgsIsMutable();
args_.add(value);
onChanged();
return this;
}
/**
* repeated bytes args = 2;
+ * @param values The args to add.
+ * @return This builder for chaining.
*/
public Builder addAllArgs(
java.lang.Iterable extends com.google.protobuf.ByteString> values) {
@@ -701,6 +665,7 @@ public Builder addAllArgs(
}
/**
* repeated bytes args = 2;
+ * @return This builder for chaining.
*/
public Builder clearArgs() {
args_ = java.util.Collections.emptyList();
@@ -709,34 +674,42 @@ public Builder clearArgs() {
return this;
}
- private com.google.protobuf.LazyStringList argTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY;
+ private com.google.protobuf.LazyStringArrayList argTypes_ =
+ com.google.protobuf.LazyStringArrayList.emptyList();
private void ensureArgTypesIsMutable() {
- if (!((bitField0_ & 0x00000004) != 0)) {
+ if (!argTypes_.isModifiable()) {
argTypes_ = new com.google.protobuf.LazyStringArrayList(argTypes_);
- bitField0_ |= 0x00000004;
- }
+ }
+ bitField0_ |= 0x00000004;
}
/**
* repeated string argTypes = 3;
+ * @return A list containing the argTypes.
*/
public com.google.protobuf.ProtocolStringList
getArgTypesList() {
- return argTypes_.getUnmodifiableView();
+ argTypes_.makeImmutable();
+ return argTypes_;
}
/**
* repeated string argTypes = 3;
+ * @return The count of argTypes.
*/
public int getArgTypesCount() {
return argTypes_.size();
}
/**
* repeated string argTypes = 3;
+ * @param index The index of the element to return.
+ * @return The argTypes at the given index.
*/
public java.lang.String getArgTypes(int index) {
return argTypes_.get(index);
}
/**
* repeated string argTypes = 3;
+ * @param index The index of the value to return.
+ * @return The bytes of the argTypes at the given index.
*/
public com.google.protobuf.ByteString
getArgTypesBytes(int index) {
@@ -744,61 +717,70 @@ public java.lang.String getArgTypes(int index) {
}
/**
* repeated string argTypes = 3;
+ * @param index The index to set the value at.
+ * @param value The argTypes to set.
+ * @return This builder for chaining.
*/
public Builder setArgTypes(
int index, java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureArgTypesIsMutable();
+ if (value == null) { throw new NullPointerException(); }
+ ensureArgTypesIsMutable();
argTypes_.set(index, value);
+ bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* repeated string argTypes = 3;
+ * @param value The argTypes to add.
+ * @return This builder for chaining.
*/
public Builder addArgTypes(
java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- ensureArgTypesIsMutable();
+ if (value == null) { throw new NullPointerException(); }
+ ensureArgTypesIsMutable();
argTypes_.add(value);
+ bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* repeated string argTypes = 3;
+ * @param values The argTypes to add.
+ * @return This builder for chaining.
*/
public Builder addAllArgTypes(
java.lang.Iterable values) {
ensureArgTypesIsMutable();
com.google.protobuf.AbstractMessageLite.Builder.addAll(
values, argTypes_);
+ bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* repeated string argTypes = 3;
+ * @return This builder for chaining.
*/
public Builder clearArgTypes() {
- argTypes_ = com.google.protobuf.LazyStringArrayList.EMPTY;
- bitField0_ = (bitField0_ & ~0x00000004);
+ argTypes_ =
+ com.google.protobuf.LazyStringArrayList.emptyList();
+ bitField0_ = (bitField0_ & ~0x00000004);;
onChanged();
return this;
}
/**
* repeated string argTypes = 3;
+ * @param value The bytes of the argTypes to add.
+ * @return This builder for chaining.
*/
public Builder addArgTypesBytes(
com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- checkByteStringIsUtf8(value);
+ if (value == null) { throw new NullPointerException(); }
+ checkByteStringIsUtf8(value);
ensureArgTypesIsMutable();
argTypes_.add(value);
+ bitField0_ |= 0x00000004;
onChanged();
return this;
}
@@ -835,7 +817,18 @@ public Request parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- return new Request(input, extensionRegistry);
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
}
};
diff --git a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/RequestOrBuilder.java b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/RequestOrBuilder.java
index 5bbe848e8..bd580afc0 100644
--- a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/RequestOrBuilder.java
+++ b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/RequestOrBuilder.java
@@ -9,42 +9,54 @@ public interface RequestOrBuilder extends
/**
* string serializeType = 1;
+ * @return The serializeType.
*/
java.lang.String getSerializeType();
/**
* string serializeType = 1;
+ * @return The bytes for serializeType.
*/
com.google.protobuf.ByteString
getSerializeTypeBytes();
/**
* repeated bytes args = 2;
+ * @return A list containing the args.
*/
java.util.List getArgsList();
/**
* repeated bytes args = 2;
+ * @return The count of args.
*/
int getArgsCount();
/**
* repeated bytes args = 2;
+ * @param index The index of the element to return.
+ * @return The args at the given index.
*/
com.google.protobuf.ByteString getArgs(int index);
/**
* repeated string argTypes = 3;
+ * @return A list containing the argTypes.
*/
java.util.List
getArgTypesList();
/**
* repeated string argTypes = 3;
+ * @return The count of argTypes.
*/
int getArgTypesCount();
/**
* repeated string argTypes = 3;
+ * @param index The index of the element to return.
+ * @return The argTypes at the given index.
*/
java.lang.String getArgTypes(int index);
/**
* repeated string argTypes = 3;
+ * @param index The index of the value to return.
+ * @return The bytes of the argTypes at the given index.
*/
com.google.protobuf.ByteString
getArgTypesBytes(int index);
diff --git a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Response.java b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Response.java
index 19f0ffa6c..366f21ce7 100644
--- a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Response.java
+++ b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/Response.java
@@ -6,7 +6,7 @@
/**
* Protobuf type {@code Response}
*/
-public final class Response extends
+public final class Response extends
com.google.protobuf.GeneratedMessageV3 implements
// @@protoc_insertion_point(message_implements:Response)
ResponseOrBuilder {
@@ -22,65 +22,12 @@ private Response() {
}
@java.lang.Override
- public final com.google.protobuf.UnknownFieldSet
- getUnknownFields() {
- return this.unknownFields;
- }
- private Response(
- com.google.protobuf.CodedInputStream input,
- com.google.protobuf.ExtensionRegistryLite extensionRegistry)
- throws com.google.protobuf.InvalidProtocolBufferException {
- this();
- if (extensionRegistry == null) {
- throw new java.lang.NullPointerException();
- }
- int mutable_bitField0_ = 0;
- com.google.protobuf.UnknownFieldSet.Builder unknownFields =
- com.google.protobuf.UnknownFieldSet.newBuilder();
- try {
- boolean done = false;
- while (!done) {
- int tag = input.readTag();
- switch (tag) {
- case 0:
- done = true;
- break;
- case 10: {
- java.lang.String s = input.readStringRequireUtf8();
-
- serializeType_ = s;
- break;
- }
- case 18: {
-
- data_ = input.readBytes();
- break;
- }
- case 26: {
- java.lang.String s = input.readStringRequireUtf8();
-
- type_ = s;
- break;
- }
- default: {
- if (!parseUnknownField(
- input, unknownFields, extensionRegistry, tag)) {
- done = true;
- }
- break;
- }
- }
- }
- } catch (com.google.protobuf.InvalidProtocolBufferException e) {
- throw e.setUnfinishedMessage(this);
- } catch (java.io.IOException e) {
- throw new com.google.protobuf.InvalidProtocolBufferException(
- e).setUnfinishedMessage(this);
- } finally {
- this.unknownFields = unknownFields.build();
- makeExtensionsImmutable();
- }
+ @SuppressWarnings({"unused"})
+ protected java.lang.Object newInstance(
+ UnusedPrivateParameter unused) {
+ return new Response();
}
+
public static final com.google.protobuf.Descriptors.Descriptor
getDescriptor() {
return triple.GenericProto.internal_static_Response_descriptor;
@@ -95,10 +42,13 @@ private Response(
}
public static final int SERIALIZETYPE_FIELD_NUMBER = 1;
- private volatile java.lang.Object serializeType_;
+ @SuppressWarnings("serial")
+ private volatile java.lang.Object serializeType_ = "";
/**
* string serializeType = 1;
+ * @return The serializeType.
*/
+ @java.lang.Override
public java.lang.String getSerializeType() {
java.lang.Object ref = serializeType_;
if (ref instanceof java.lang.String) {
@@ -113,7 +63,9 @@ public java.lang.String getSerializeType() {
}
/**
* string serializeType = 1;
+ * @return The bytes for serializeType.
*/
+ @java.lang.Override
public com.google.protobuf.ByteString
getSerializeTypeBytes() {
java.lang.Object ref = serializeType_;
@@ -129,19 +81,24 @@ public java.lang.String getSerializeType() {
}
public static final int DATA_FIELD_NUMBER = 2;
- private com.google.protobuf.ByteString data_;
+ private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
/**
* bytes data = 2;
+ * @return The data.
*/
+ @java.lang.Override
public com.google.protobuf.ByteString getData() {
return data_;
}
public static final int TYPE_FIELD_NUMBER = 3;
- private volatile java.lang.Object type_;
+ @SuppressWarnings("serial")
+ private volatile java.lang.Object type_ = "";
/**
* string type = 3;
+ * @return The type.
*/
+ @java.lang.Override
public java.lang.String getType() {
java.lang.Object ref = type_;
if (ref instanceof java.lang.String) {
@@ -156,7 +113,9 @@ public java.lang.String getType() {
}
/**
* string type = 3;
+ * @return The bytes for type.
*/
+ @java.lang.Override
public com.google.protobuf.ByteString
getTypeBytes() {
java.lang.Object ref = type_;
@@ -185,16 +144,16 @@ public final boolean isInitialized() {
@java.lang.Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- if (!getSerializeTypeBytes().isEmpty()) {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serializeType_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 1, serializeType_);
}
if (!data_.isEmpty()) {
output.writeBytes(2, data_);
}
- if (!getTypeBytes().isEmpty()) {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) {
com.google.protobuf.GeneratedMessageV3.writeString(output, 3, type_);
}
- unknownFields.writeTo(output);
+ getUnknownFields().writeTo(output);
}
@java.lang.Override
@@ -203,17 +162,17 @@ public int getSerializedSize() {
if (size != -1) return size;
size = 0;
- if (!getSerializeTypeBytes().isEmpty()) {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(serializeType_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(1, serializeType_);
}
if (!data_.isEmpty()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, data_);
}
- if (!getTypeBytes().isEmpty()) {
+ if (!com.google.protobuf.GeneratedMessageV3.isStringEmpty(type_)) {
size += com.google.protobuf.GeneratedMessageV3.computeStringSize(3, type_);
}
- size += unknownFields.getSerializedSize();
+ size += getUnknownFields().getSerializedSize();
memoizedSize = size;
return size;
}
@@ -234,7 +193,7 @@ public boolean equals(final java.lang.Object obj) {
.equals(other.getData())) return false;
if (!getType()
.equals(other.getType())) return false;
- if (!unknownFields.equals(other.unknownFields)) return false;
+ if (!getUnknownFields().equals(other.getUnknownFields())) return false;
return true;
}
@@ -251,7 +210,7 @@ public int hashCode() {
hash = (53 * hash) + getData().hashCode();
hash = (37 * hash) + TYPE_FIELD_NUMBER;
hash = (53 * hash) + getType().hashCode();
- hash = (29 * hash) + unknownFields.hashCode();
+ hash = (29 * hash) + getUnknownFields().hashCode();
memoizedHashCode = hash;
return hash;
}
@@ -368,28 +327,21 @@ public static final class Builder extends
// Construct using triple.Response.newBuilder()
private Builder() {
- maybeForceBuilderInitialization();
+
}
private Builder(
com.google.protobuf.GeneratedMessageV3.BuilderParent parent) {
super(parent);
- maybeForceBuilderInitialization();
- }
- private void maybeForceBuilderInitialization() {
- if (com.google.protobuf.GeneratedMessageV3
- .alwaysUseFieldBuilders) {
- }
+
}
@java.lang.Override
public Builder clear() {
super.clear();
+ bitField0_ = 0;
serializeType_ = "";
-
data_ = com.google.protobuf.ByteString.EMPTY;
-
type_ = "";
-
return this;
}
@@ -416,45 +368,24 @@ public triple.Response build() {
@java.lang.Override
public triple.Response buildPartial() {
triple.Response result = new triple.Response(this);
- result.serializeType_ = serializeType_;
- result.data_ = data_;
- result.type_ = type_;
+ if (bitField0_ != 0) { buildPartial0(result); }
onBuilt();
return result;
}
- @java.lang.Override
- public Builder clone() {
- return super.clone();
- }
- @java.lang.Override
- public Builder setField(
- com.google.protobuf.Descriptors.FieldDescriptor field,
- java.lang.Object value) {
- return super.setField(field, value);
- }
- @java.lang.Override
- public Builder clearField(
- com.google.protobuf.Descriptors.FieldDescriptor field) {
- return super.clearField(field);
- }
- @java.lang.Override
- public Builder clearOneof(
- com.google.protobuf.Descriptors.OneofDescriptor oneof) {
- return super.clearOneof(oneof);
- }
- @java.lang.Override
- public Builder setRepeatedField(
- com.google.protobuf.Descriptors.FieldDescriptor field,
- int index, java.lang.Object value) {
- return super.setRepeatedField(field, index, value);
- }
- @java.lang.Override
- public Builder addRepeatedField(
- com.google.protobuf.Descriptors.FieldDescriptor field,
- java.lang.Object value) {
- return super.addRepeatedField(field, value);
+ private void buildPartial0(triple.Response result) {
+ int from_bitField0_ = bitField0_;
+ if (((from_bitField0_ & 0x00000001) != 0)) {
+ result.serializeType_ = serializeType_;
+ }
+ if (((from_bitField0_ & 0x00000002) != 0)) {
+ result.data_ = data_;
+ }
+ if (((from_bitField0_ & 0x00000004) != 0)) {
+ result.type_ = type_;
+ }
}
+
@java.lang.Override
public Builder mergeFrom(com.google.protobuf.Message other) {
if (other instanceof triple.Response) {
@@ -469,6 +400,7 @@ public Builder mergeFrom(triple.Response other) {
if (other == triple.Response.getDefaultInstance()) return this;
if (!other.getSerializeType().isEmpty()) {
serializeType_ = other.serializeType_;
+ bitField0_ |= 0x00000001;
onChanged();
}
if (other.getData() != com.google.protobuf.ByteString.EMPTY) {
@@ -476,9 +408,10 @@ public Builder mergeFrom(triple.Response other) {
}
if (!other.getType().isEmpty()) {
type_ = other.type_;
+ bitField0_ |= 0x00000004;
onChanged();
}
- this.mergeUnknownFields(other.unknownFields);
+ this.mergeUnknownFields(other.getUnknownFields());
onChanged();
return this;
}
@@ -493,23 +426,53 @@ public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws java.io.IOException {
- triple.Response parsedMessage = null;
+ if (extensionRegistry == null) {
+ throw new java.lang.NullPointerException();
+ }
try {
- parsedMessage = PARSER.parsePartialFrom(input, extensionRegistry);
+ boolean done = false;
+ while (!done) {
+ int tag = input.readTag();
+ switch (tag) {
+ case 0:
+ done = true;
+ break;
+ case 10: {
+ serializeType_ = input.readStringRequireUtf8();
+ bitField0_ |= 0x00000001;
+ break;
+ } // case 10
+ case 18: {
+ data_ = input.readBytes();
+ bitField0_ |= 0x00000002;
+ break;
+ } // case 18
+ case 26: {
+ type_ = input.readStringRequireUtf8();
+ bitField0_ |= 0x00000004;
+ break;
+ } // case 26
+ default: {
+ if (!super.parseUnknownField(input, extensionRegistry, tag)) {
+ done = true; // was an endgroup tag
+ }
+ break;
+ } // default:
+ } // switch (tag)
+ } // while (!done)
} catch (com.google.protobuf.InvalidProtocolBufferException e) {
- parsedMessage = (triple.Response) e.getUnfinishedMessage();
throw e.unwrapIOException();
} finally {
- if (parsedMessage != null) {
- mergeFrom(parsedMessage);
- }
- }
+ onChanged();
+ } // finally
return this;
}
+ private int bitField0_;
private java.lang.Object serializeType_ = "";
/**
* string serializeType = 1;
+ * @return The serializeType.
*/
public java.lang.String getSerializeType() {
java.lang.Object ref = serializeType_;
@@ -525,6 +488,7 @@ public java.lang.String getSerializeType() {
}
/**
* string serializeType = 1;
+ * @return The bytes for serializeType.
*/
public com.google.protobuf.ByteString
getSerializeTypeBytes() {
@@ -541,37 +505,38 @@ public java.lang.String getSerializeType() {
}
/**
* string serializeType = 1;
+ * @param value The serializeType to set.
+ * @return This builder for chaining.
*/
public Builder setSerializeType(
java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
-
+ if (value == null) { throw new NullPointerException(); }
serializeType_ = value;
+ bitField0_ |= 0x00000001;
onChanged();
return this;
}
/**
* string serializeType = 1;
+ * @return This builder for chaining.
*/
public Builder clearSerializeType() {
-
serializeType_ = getDefaultInstance().getSerializeType();
+ bitField0_ = (bitField0_ & ~0x00000001);
onChanged();
return this;
}
/**
* string serializeType = 1;
+ * @param value The bytes for serializeType to set.
+ * @return This builder for chaining.
*/
public Builder setSerializeTypeBytes(
com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- checkByteStringIsUtf8(value);
-
+ if (value == null) { throw new NullPointerException(); }
+ checkByteStringIsUtf8(value);
serializeType_ = value;
+ bitField0_ |= 0x00000001;
onChanged();
return this;
}
@@ -579,27 +544,30 @@ public Builder setSerializeTypeBytes(
private com.google.protobuf.ByteString data_ = com.google.protobuf.ByteString.EMPTY;
/**
* bytes data = 2;
+ * @return The data.
*/
+ @java.lang.Override
public com.google.protobuf.ByteString getData() {
return data_;
}
/**
* bytes data = 2;
+ * @param value The data to set.
+ * @return This builder for chaining.
*/
public Builder setData(com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
-
+ if (value == null) { throw new NullPointerException(); }
data_ = value;
+ bitField0_ |= 0x00000002;
onChanged();
return this;
}
/**
* bytes data = 2;
+ * @return This builder for chaining.
*/
public Builder clearData() {
-
+ bitField0_ = (bitField0_ & ~0x00000002);
data_ = getDefaultInstance().getData();
onChanged();
return this;
@@ -608,6 +576,7 @@ public Builder clearData() {
private java.lang.Object type_ = "";
/**
* string type = 3;
+ * @return The type.
*/
public java.lang.String getType() {
java.lang.Object ref = type_;
@@ -623,6 +592,7 @@ public java.lang.String getType() {
}
/**
* string type = 3;
+ * @return The bytes for type.
*/
public com.google.protobuf.ByteString
getTypeBytes() {
@@ -639,37 +609,38 @@ public java.lang.String getType() {
}
/**
* string type = 3;
+ * @param value The type to set.
+ * @return This builder for chaining.
*/
public Builder setType(
java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
-
+ if (value == null) { throw new NullPointerException(); }
type_ = value;
+ bitField0_ |= 0x00000004;
onChanged();
return this;
}
/**
* string type = 3;
+ * @return This builder for chaining.
*/
public Builder clearType() {
-
type_ = getDefaultInstance().getType();
+ bitField0_ = (bitField0_ & ~0x00000004);
onChanged();
return this;
}
/**
* string type = 3;
+ * @param value The bytes for type to set.
+ * @return This builder for chaining.
*/
public Builder setTypeBytes(
com.google.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- checkByteStringIsUtf8(value);
-
+ if (value == null) { throw new NullPointerException(); }
+ checkByteStringIsUtf8(value);
type_ = value;
+ bitField0_ |= 0x00000004;
onChanged();
return this;
}
@@ -706,7 +677,18 @@ public Response parsePartialFrom(
com.google.protobuf.CodedInputStream input,
com.google.protobuf.ExtensionRegistryLite extensionRegistry)
throws com.google.protobuf.InvalidProtocolBufferException {
- return new Response(input, extensionRegistry);
+ Builder builder = newBuilder();
+ try {
+ builder.mergeFrom(input, extensionRegistry);
+ } catch (com.google.protobuf.InvalidProtocolBufferException e) {
+ throw e.setUnfinishedMessage(builder.buildPartial());
+ } catch (com.google.protobuf.UninitializedMessageException e) {
+ throw e.asInvalidProtocolBufferException().setUnfinishedMessage(builder.buildPartial());
+ } catch (java.io.IOException e) {
+ throw new com.google.protobuf.InvalidProtocolBufferException(e)
+ .setUnfinishedMessage(builder.buildPartial());
+ }
+ return builder.buildPartial();
}
};
diff --git a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/ResponseOrBuilder.java b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/ResponseOrBuilder.java
index cdf4c0eb0..6f989bddf 100644
--- a/remoting/remoting-triple/build/generated/source/proto/main/java/triple/ResponseOrBuilder.java
+++ b/remoting/remoting-triple/build/generated/source/proto/main/java/triple/ResponseOrBuilder.java
@@ -9,25 +9,30 @@ public interface ResponseOrBuilder extends
/**
* string serializeType = 1;
+ * @return The serializeType.
*/
java.lang.String getSerializeType();
/**
* string serializeType = 1;
+ * @return The bytes for serializeType.
*/
com.google.protobuf.ByteString
getSerializeTypeBytes();
/**
* bytes data = 2;
+ * @return The data.
*/
com.google.protobuf.ByteString getData();
/**
* string type = 3;
+ * @return The type.
*/
java.lang.String getType();
/**
* string type = 3;
+ * @return The bytes for type.
*/
com.google.protobuf.ByteString
getTypeBytes();
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() {
diff --git a/test/test-integration/pom.xml b/test/test-integration/pom.xml
index d4a6c8a25..5d78a8e48 100644
--- a/test/test-integration/pom.xml
+++ b/test/test-integration/pom.xml
@@ -13,10 +13,10 @@
sofa-rpc-test-integration
- 3.11.0
- 1.17.0
+ 3.22.0
+ 1.53.0
0.0.2
- 1.28.0
+ 1.53.0
3.7.0
@@ -324,7 +324,7 @@
protobuf-maven-plugin
0.5.1
- com.google.protobuf:protoc:3.7.1:exe:${os.detected.classifier}
+ com.google.protobuf:protoc:${protoc.version}:exe:${os.detected.classifier}
grpc-java
io.grpc:protoc-gen-grpc-java:${grpc.version}:exe:${os.detected.classifier}
build/generated/source/proto/main/java
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageAsyncChainTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageAsyncChainTest.java
index e29ec5c25..f28ff7c9d 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageAsyncChainTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageAsyncChainTest.java
@@ -71,7 +71,7 @@ public void doTest() throws Exception {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C5");
- referenceBeanC.setDirectUrl("localhost:12299");
+ referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
MethodConfig methodConfigC = new MethodConfig()
.setName("hello")
@@ -84,7 +84,7 @@ public void doTest() throws Exception {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D5");
- referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
+ referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();
@@ -107,7 +107,7 @@ public void doTest() throws Exception {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B5");
referenceBeanA.setInterfaceId(SampleService.class.getName());
- referenceBeanA.setDirectUrl("localhost:12299");
+ referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageCallbackTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageCallbackTest.java
index f67e8638f..efd21d684 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageCallbackTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageCallbackTest.java
@@ -72,7 +72,7 @@ public void doTest() throws Exception {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C3");
- referenceBeanC.setDirectUrl("localhost:12299");
+ referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
MethodConfig methodConfigC = new MethodConfig()
.setName("hello")
@@ -85,7 +85,7 @@ public void doTest() throws Exception {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D3");
- referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
+ referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
MethodConfig methodConfigD = new MethodConfig()
.setName("hello")
@@ -112,7 +112,7 @@ public void doTest() throws Exception {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B3");
referenceBeanA.setInterfaceId(SampleService.class.getName());
- referenceBeanA.setDirectUrl("localhost:12299");
+ referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageFutureTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageFutureTest.java
index 157fa300b..0137e395e 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageFutureTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageFutureTest.java
@@ -66,7 +66,7 @@ public void doTest() throws Exception {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C2");
- referenceBeanC.setDirectUrl("localhost:12299");
+ referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
MethodConfig methodConfigC = new MethodConfig()
.setName("hello")
@@ -79,7 +79,7 @@ public void doTest() throws Exception {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D2");
- referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
+ referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
MethodConfig methodConfigD = new MethodConfig()
.setName("hello")
@@ -103,7 +103,7 @@ public void doTest() throws Exception {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B2");
referenceBeanA.setInterfaceId(SampleService.class.getName());
- referenceBeanA.setDirectUrl("localhost:12299");
+ referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageOnewayTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageOnewayTest.java
index 5deb9685d..ac40fd04f 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageOnewayTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageOnewayTest.java
@@ -65,7 +65,7 @@ void doTest() {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C4");
- referenceBeanC.setDirectUrl("localhost:12299");
+ referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
SampleService sampleServiceC = (SampleService) referenceBeanC.refer();
@@ -74,7 +74,7 @@ void doTest() {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D4");
- referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
+ referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();
@@ -94,7 +94,7 @@ void doTest() {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B4");
referenceBeanA.setInterfaceId(SampleService.class.getName());
- referenceBeanA.setDirectUrl("localhost:12299");
+ referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
MethodConfig methodConfigA = new MethodConfig()
.setName("hello")
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageSyncTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageSyncTest.java
index ba649a379..d476b8b29 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageSyncTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BaggageSyncTest.java
@@ -62,7 +62,7 @@ void doTest() {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C1");
- referenceBeanC.setDirectUrl("localhost:12299");
+ referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setTimeout(1000);
SampleService sampleServiceC = (SampleService) referenceBeanC.refer();
@@ -71,7 +71,7 @@ void doTest() {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D1");
- referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
+ referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();
@@ -91,7 +91,7 @@ void doTest() {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B1");
referenceBeanA.setInterfaceId(SampleService.class.getName());
- referenceBeanA.setDirectUrl("localhost:12299");
+ referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setTimeout(3000);
SampleService service = (SampleService) referenceBeanA.refer();
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BoltProtobufBaggageSyncTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BoltProtobufBaggageSyncTest.java
index 4d8f24585..cdfe22811 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BoltProtobufBaggageSyncTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/baggage/BoltProtobufBaggageSyncTest.java
@@ -65,7 +65,7 @@ void doTest() {
referenceBeanC.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanC.setInterfaceId(SampleService.class.getName());
referenceBeanC.setUniqueId("C1");
- referenceBeanC.setDirectUrl("localhost:12299");
+ referenceBeanC.setDirectUrl("127.0.0.1:12299");
referenceBeanC.setSerialization("protobuf");
referenceBeanC.setTimeout(1000);
SampleService sampleServiceC = (SampleService) referenceBeanC.refer();
@@ -75,7 +75,7 @@ void doTest() {
referenceBeanD.setApplication(new ApplicationConfig().setAppName("BBB"));
referenceBeanD.setInterfaceId(SampleService.class.getName());
referenceBeanD.setUniqueId("D1");
- referenceBeanD.setDirectUrl("localhost:12299?p=1&v=4.0");
+ referenceBeanD.setDirectUrl("127.0.0.1:12299?p=1&v=4.0");
referenceBeanD.setSerialization("protobuf");
referenceBeanD.setTimeout(1000);
SampleService sampleServiceD = (SampleService) referenceBeanD.refer();
@@ -96,7 +96,7 @@ void doTest() {
referenceBeanA.setApplication(new ApplicationConfig().setAppName("AAA"));
referenceBeanA.setUniqueId("B1");
referenceBeanA.setInterfaceId(SampleService.class.getName());
- referenceBeanA.setDirectUrl("localhost:12299");
+ referenceBeanA.setDirectUrl("127.0.0.1:12299");
referenceBeanA.setSerialization("protobuf");
referenceBeanA.setTimeout(3000);
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/TripleServerTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/TripleServerTest.java
index 3d1bbd970..3c608ca86 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/TripleServerTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/test/triple/TripleServerTest.java
@@ -28,6 +28,8 @@
import com.alipay.sofa.rpc.context.RpcRunningState;
import com.alipay.sofa.rpc.context.RpcRuntimeContext;
import com.alipay.sofa.rpc.core.exception.SofaTimeOutException;
+import io.grpc.Status;
+import io.grpc.StatusException;
import io.grpc.examples.helloworld.HelloReply;
import io.grpc.examples.helloworld.HelloRequest;
import io.grpc.examples.helloworld.SofaGreeterTriple;
@@ -327,19 +329,19 @@ public void testDefaultMessageSize() {
SampleService sampleService = consumerConfig.refer();
String msg = buildMsg(1);
try {
- sampleService.messageSize(msg, 5*1024);
+ sampleService.messageSize(msg, 5 * 1024);
Assert.fail();
} catch (Exception e) {
Assert.assertTrue(e.getMessage().contains("gRPC message exceeds maximum size 4194304:"));
}
- msg = buildMsg(5*1024);
+ msg = buildMsg(5 * 1024);
try {
sampleService.messageSize(msg, 1);
Assert.fail();
} catch (Exception e) {
// The client actively cancelled the request, resulting in the server returning a CANCELLED error.
- Assert.assertTrue(e.getMessage().contains("CANCELLED: HTTP/2 error code: CANCEL"));
+ Assert.assertTrue(((StatusException) e.getCause()).getStatus().getCode().equals(Status.CANCELLED.getCode()));
}
} finally {
RpcRunningState.setDebugMode(originDebugMode);
diff --git a/test/test-integration/src/test/java/com/alipay/sofa/rpc/triple/TripleHessianInvokeTest.java b/test/test-integration/src/test/java/com/alipay/sofa/rpc/triple/TripleHessianInvokeTest.java
index ad88a35e3..535d66e05 100644
--- a/test/test-integration/src/test/java/com/alipay/sofa/rpc/triple/TripleHessianInvokeTest.java
+++ b/test/test-integration/src/test/java/com/alipay/sofa/rpc/triple/TripleHessianInvokeTest.java
@@ -81,7 +81,7 @@ public void testInvoke() throws InterruptedException {
ConsumerConfig consumerConfig = new ConsumerConfig();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
- .setDirectUrl("localhost:" + port)
+ .setDirectUrl("127.0.0.1:" + port)
.setRegister(false)
.setApplication(clientApp);
@@ -152,7 +152,7 @@ public void testInvokeWithUniqueId() throws InterruptedException {
ConsumerConfig consumerConfig = new ConsumerConfig();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
- .setDirectUrl("localhost:" + port)
+ .setDirectUrl("127.0.0.1:" + port)
.setUniqueId(uniqueId)
.setRegister(false)
.setApplication(clientApp);
@@ -183,7 +183,7 @@ public void testInvokeWithUniqueId() throws InterruptedException {
consumerConfig = new ConsumerConfig();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
- .setDirectUrl("localhost:" + port)
+ .setDirectUrl("127.0.0.1:" + port)
.setRegister(false)
.setApplication(clientApp);
@@ -313,7 +313,7 @@ public void testExposeTwoUniqueId() {
ConsumerConfig consumerConfig = new ConsumerConfig<>();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
- .setDirectUrl("localhost:" + port)
+ .setDirectUrl("127.0.0.1:" + port)
.setUniqueId(uniqueId)
.setRegister(false)
.setApplication(clientApp);
@@ -324,7 +324,7 @@ public void testExposeTwoUniqueId() {
ConsumerConfig consumerConfig2 = new ConsumerConfig<>();
consumerConfig2.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
- .setDirectUrl("localhost:" + port)
+ .setDirectUrl("127.0.0.1:" + port)
.setUniqueId(uniqueId2)
.setRegister(false)
.setApplication(clientApp);
@@ -362,7 +362,7 @@ public void testTripleRpcInvokeContext() {
ConsumerConfig consumerConfig = new ConsumerConfig();
consumerConfig.setInterfaceId(TripleHessianInterface.class.getName())
.setProtocol(RpcConstants.PROTOCOL_TYPE_TRIPLE)
- .setDirectUrl("localhost:" + port)
+ .setDirectUrl("127.0.0.1:" + port)
.setTimeout(300000)
.setRegister(false)
.setApplication(clientApp);
diff --git a/tracer/tracer-opentracing/pom.xml b/tracer/tracer-opentracing/pom.xml
index 381345d8f..64a7856fd 100644
--- a/tracer/tracer-opentracing/pom.xml
+++ b/tracer/tracer-opentracing/pom.xml
@@ -13,8 +13,6 @@
sofa-rpc-tracer-opentracing
-
-
com.alipay.sofa
tracer-core
@@ -32,16 +30,6 @@
-
- org.jmockit
- jmockit
- test
-
-
- org.mockito
- mockito-core
- test
-
junit
junit