Skip to content
This repository was archived by the owner on Feb 18, 2024. It is now read-only.

Commit 82a0bed

Browse files
committed
try to simplify the serialization
1 parent bfab24e commit 82a0bed

File tree

10 files changed

+46
-41
lines changed

10 files changed

+46
-41
lines changed

samples/springboot-samples/pom.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@
3838
<module>web/tomcat</module>
3939
<module>web/webflux/base</module>
4040
<module>web/webflux/biz</module>
41-
<module>service/base</module>
42-
<module>service/biz1</module>
43-
<module>service/biz2</module>
41+
<module>service</module>
4442
<module>slimming/log4j2</module>
4543
<module>msg/kafka/base</module>
4644
<module>msg/kafka/biz1</module>

samples/springboot-samples/service/base/base-bootstrap/src/main/java/com/alipay/sofa/base/rest/SampleController.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,23 +22,23 @@ public class SampleController {
2222
@RequestMapping(value = "/", method = RequestMethod.GET)
2323
public String hello() {
2424

25-
Provider studentProvider = SpringServiceFinder.getModuleService("biz", "0.0.1-SNAPSHOT",
25+
Provider studentProvider = SpringServiceFinder.getModuleService("biz1", "0.0.1-SNAPSHOT",
2626
"studentProvider", Provider.class);
2727
Result result = studentProvider.provide(new Param());
2828
System.out.println(result.getClass());
2929
System.out.println(result.isSuccess());
3030
System.out.println(result.getPeople().getClass());
3131
System.out.println(result);
3232

33-
Provider teacherProvider = SpringServiceFinder.getModuleService("biz", "0.0.1-SNAPSHOT",
33+
Provider teacherProvider = SpringServiceFinder.getModuleService("biz1", "0.0.1-SNAPSHOT",
3434
"teacherProvider", Provider.class);
3535
Result result1 = teacherProvider.provide(new Param());
3636
System.out.println(result1.getClass());
3737
System.out.println(result1.isSuccess());
3838
System.out.println(result1.getPeople().getClass());
3939
System.out.println(result1);
4040

41-
Map<String, Provider> providerMap = SpringServiceFinder.listModuleServices("biz", "0.0.1-SNAPSHOT",
41+
Map<String, Provider> providerMap = SpringServiceFinder.listModuleServices("biz1", "0.0.1-SNAPSHOT",
4242
Provider.class);
4343
for (String beanName : providerMap.keySet()) {
4444
Result result2 = providerMap.get(beanName).provide(new Param());

samples/springboot-samples/service/base/pom.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
<module>base-bootstrap</module>
99
</modules>
1010
<parent>
11-
<groupId>com.alipay.sofa</groupId>
12-
<artifactId>springboot-samples</artifactId>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
14+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1515
</parent>
16-
<groupId>com.alipay.sofa.service</groupId>
1716
<artifactId>base</artifactId>
1817
<version>0.0.1-SNAPSHOT</version>
19-
<name>sample-service-base</name>
20-
<description>sample-service-base</description>
2118
<packaging>pom</packaging>
2219

2320
<dependencyManagement>

samples/springboot-samples/service/biz1/pom.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
<module>biz1-facade</module>
99
</modules>
1010
<parent>
11-
<groupId>com.alipay.sofa</groupId>
12-
<artifactId>springboot-samples</artifactId>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
14+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1515
</parent>
16-
<groupId>com.alipay.sofa.service</groupId>
1716
<artifactId>biz1</artifactId>
1817
<version>0.0.1-SNAPSHOT</version>
19-
<name>sample-service-biz</name>
20-
<description>sample-service-biz</description>
2118

2219
<dependencyManagement>
2320
<dependencies>

samples/springboot-samples/service/biz2/pom.xml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,13 @@
88
<module>biz2-facade</module>
99
</modules>
1010
<parent>
11-
<groupId>com.alipay.sofa</groupId>
12-
<artifactId>springboot-samples</artifactId>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
1313
<version>0.0.1-SNAPSHOT</version>
14-
<relativePath>../../pom.xml</relativePath> <!-- lookup parent from repository -->
14+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
1515
</parent>
16-
<groupId>com.alipay.sofa.service</groupId>
1716
<artifactId>biz2</artifactId>
1817
<version>0.0.1-SNAPSHOT</version>
19-
<name>sample-service-biz2</name>
20-
<description>sample-service-biz2</description>
2118

2219
<dependencyManagement>
2320
<dependencies>
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
<parent>
6+
<groupId>com.alipay.sofa</groupId>
7+
<artifactId>springboot-samples</artifactId>
8+
<version>0.0.1-SNAPSHOT</version>
9+
<relativePath>../pom.xml</relativePath> <!-- lookup parent from repository -->
10+
</parent>
11+
<groupId>com.alipay.sofa.service</groupId>
12+
<artifactId>cross-biz-calling</artifactId>
13+
<version>0.0.1-SNAPSHOT</version>
14+
<packaging>pom</packaging>
15+
16+
<modules>
17+
<module>base</module>
18+
<module>biz1</module>
19+
<module>biz2</module>
20+
</modules>
21+
</project>

sofa-serverless-runtime/arklet-core/src/main/java/com/alipay/sofa/serverless/arklet/core/health/HealthServiceImpl.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@
1616
*/
1717
package com.alipay.sofa.serverless.arklet.core.health;
1818

19-
import com.alibaba.fastjson.JSON;
20-
import com.alibaba.fastjson.JSONObject;
2119
import com.alipay.sofa.ark.api.ArkClient;
2220
import com.alipay.sofa.ark.common.util.AssertUtils;
2321
import com.alipay.sofa.ark.common.util.StringUtils;

sofa-serverless-runtime/pom.xml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
<packaging>pom</packaging>
1010

1111
<properties>
12-
<sofa.ark.version>3.0.1</sofa.ark.version>
13-
<spring.boot.version>3.0.9</spring.boot.version>
14-
<revision>0.5.5-jdk17</revision>
12+
<revision>0.5.6</revision>
13+
<sofa.ark.version>2.2.6</sofa.ark.version>
14+
<spring.boot.version>2.7.15</spring.boot.version>
1515
<project.encoding>UTF-8</project.encoding>
1616
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1717
<java.version>1.8</java.version>
@@ -176,18 +176,6 @@
176176
<version>${hessian.version}</version>
177177
</dependency>
178178

179-
<dependency>
180-
<groupId>io.netty</groupId>
181-
<artifactId>netty-all</artifactId>
182-
<version>${netty.version}</version>
183-
</dependency>
184-
185-
<dependency>
186-
<groupId>org.projectlombok</groupId>
187-
<artifactId>lombok</artifactId>
188-
<version>${lombok.version}</version>
189-
</dependency>
190-
191179
<!-- 测试-->
192180
<dependency>
193181
<groupId>junit</groupId>

sofa-serverless-runtime/sofa-serverless-common/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@
4242
<groupId>com.caucho</groupId>
4343
<artifactId>hessian</artifactId>
4444
</dependency>
45+
<dependency>
46+
<groupId>com.alibaba</groupId>
47+
<artifactId>fastjson</artifactId>
48+
</dependency>
4549
<dependency>
4650
<groupId>junit</groupId>
4751
<artifactId>junit</artifactId>

sofa-serverless-runtime/sofa-serverless-common/src/main/java/com/alipay/sofa/serverless/common/util/SerializeUtils.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
*/
1717
package com.alipay.sofa.serverless.common.util;
1818

19+
import com.alibaba.fastjson.JSONObject;
1920
import com.caucho.hessian.io.Hessian2Input;
2021
import com.caucho.hessian.io.Hessian2Output;
2122
import com.caucho.hessian.io.SerializerFactory;
@@ -37,6 +38,10 @@ public static Object serializeTransform(Object source, ClassLoader targetClassLo
3738
if (targetClassLoader != null) {
3839
Thread.currentThread().setContextClassLoader(targetClassLoader);
3940
}
41+
42+
// 使用 fastjson 将 source 序列化为 byte 数组,饭后又反序列化回来
43+
// return JSONObject.parseObject(JSONObject.toJSONString(source), source.getClass());
44+
4045
SerializerFactory serializerFactory = new SerializerFactory();
4146
serializerFactory.setAllowNonSerializable(true);
4247
ByteArrayOutputStream bos = new ByteArrayOutputStream();

0 commit comments

Comments
 (0)