native hessian
diff --git a/.gitignore b/.gitignore
index 82665a0..0a0a76b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,6 @@
# jmh output
*.json
+
+# dubbo-serialization-native-hessian git repo
+dubbo-serialization-native-hessian/
diff --git a/benchmark.sh b/benchmark.sh
index 0a015fe..e4b1c3c 100755
--- a/benchmark.sh
+++ b/benchmark.sh
@@ -5,6 +5,12 @@
}
build() {
+ if [ ! -d dubbo-serialization-native-hessian ] && [[ ${PROJECT_DIR} = *native-hessian* ]]; then
+ git clone https://github.com/dubbo/dubbo-serialization-native-hessian.git
+ pushd dubbo-serialization-native-hessian
+ mvn clean install
+ popd
+ fi
mvn --projects benchmark-base,client-base,server-base,${PROJECT_DIR} clean package
}
diff --git a/client-base/src/main/java/org/apache/dubbo/Client.java b/client-base/src/main/java/org/apache/dubbo/Client.java
index c2f81f7..ac457fc 100644
--- a/client-base/src/main/java/org/apache/dubbo/Client.java
+++ b/client-base/src/main/java/org/apache/dubbo/Client.java
@@ -1,6 +1,5 @@
package org.apache.dubbo;
-import org.apache.dubbo.benchmark.bean.User;
import org.apache.dubbo.benchmark.service.UserService;
import org.springframework.context.support.ClassPathXmlApplicationContext;
@@ -9,7 +8,9 @@
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("consumer.xml");
context.start();
UserService userService = (UserService) context.getBean("userService");
- User user = userService.getUser(1);
- System.out.println("user: " + user);
+ System.out.println("existUser: " + userService.existUser("user@acme.com"));
+ System.out.println("getUser: " + userService.getUser(1));
+ System.out.println("createUser: " + userService.createUser(userService.getUser(2)));
+ System.out.println("listUser: " + userService.listUser(1));
}
}
diff --git a/dubbo-native-hessian-client/pom.xml b/dubbo-native-hessian-client/pom.xml
new file mode 100644
index 0000000..d2c19b8
--- /dev/null
+++ b/dubbo-native-hessian-client/pom.xml
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>dubbo-benchmark</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-native-hessian-client</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>client-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-native-hessian</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <inherited>true</inherited>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <inherited>true</inherited>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.dubbo.benchmark.Client</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+
+</project>
\ No newline at end of file
diff --git a/dubbo-native-hessian-client/src/main/resources/consumer.xml b/dubbo-native-hessian-client/src/main/resources/consumer.xml
new file mode 100644
index 0000000..63651c7
--- /dev/null
+++ b/dubbo-native-hessian-client/src/main/resources/consumer.xml
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder location="classpath:benchmark.properties" system-properties-mode="OVERRIDE"/>
+ <dubbo:application name="dubbo-native-hessian-client"/>
+ <dubbo:reference id="userService" check="false"
+ interface="org.apache.dubbo.benchmark.service.UserService"
+ url="dubbo://${server.host}:${server.port}?serialization=native-hessian"/>
+ <dubbo:consumer client="netty4" filter="-default"/>
+</beans>
\ No newline at end of file
diff --git a/dubbo-native-hessian-server/pom.xml b/dubbo-native-hessian-server/pom.xml
new file mode 100644
index 0000000..5e7cbd4
--- /dev/null
+++ b/dubbo-native-hessian-server/pom.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <parent>
+ <artifactId>dubbo-benchmark</artifactId>
+ <groupId>org.apache.dubbo</groupId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+ <modelVersion>4.0.0</modelVersion>
+
+ <artifactId>dubbo-native-hessian-server</artifactId>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>server-base</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-native-hessian</artifactId>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ </plugin>
+
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.apache.dubbo.benchmark.Server</mainClass>
+ </manifest>
+ </archive>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
\ No newline at end of file
diff --git a/dubbo-native-hessian-server/src/main/resources/provider.xml b/dubbo-native-hessian-server/src/main/resources/provider.xml
new file mode 100644
index 0000000..1aa66c0
--- /dev/null
+++ b/dubbo-native-hessian-server/src/main/resources/provider.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dubbo="http://code.alibabatech.com/schema/dubbo"
+ xmlns:context="http://www.springframework.org/schema/context"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+ <context:property-placeholder location="classpath:benchmark.properties" system-properties-mode="OVERRIDE"/>
+ <dubbo:application name="dubbo-native-hessian-server"/>
+ <dubbo:protocol name="dubbo" host="${server.host}" server="netty4" port="${server.port}"
+ serialization="native-hessian"/>
+ <dubbo:registry address="N/A"/>
+ <dubbo:service interface="org.apache.dubbo.benchmark.service.UserService" ref="userService" filter="-default"/>
+ <bean id="userService" class="org.apache.dubbo.benchmark.service.UserServiceServerImpl"/>
+</beans>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index bd9695d..ea0d6c0 100644
--- a/pom.xml
+++ b/pom.xml
@@ -17,6 +17,7 @@
<kryo.version>4.0.2</kryo.version>
<kryo-serializers.version>0.42</kryo-serializers.version>
<fst.version>2.48-jdk-6</fst.version>
+ <native-hessian.version>1.0-SNAPSHOT</native-hessian.version>
<jmh.version>1.21</jmh.version>
<slf4j.version>1.7.25</slf4j.version>
<logback.version>1.2.3</logback.version>
@@ -25,6 +26,7 @@
<modules>
<module>benchmark-base</module>
+ <module>server-base</module>
<module>client-base</module>
<module>dubbo-kryo-client</module>
<module>dubbo-kryo-server</module>
@@ -32,7 +34,8 @@
<module>dubbo-hessianlite-server</module>
<module>dubbo-fst-client</module>
<module>dubbo-fst-server</module>
- <module>server-base</module>
+ <module>dubbo-native-hessian-client</module>
+ <module>dubbo-native-hessian-server</module>
</modules>
<dependencies>
@@ -97,6 +100,12 @@
</dependency>
<dependency>
+ <groupId>org.apache.dubbo</groupId>
+ <artifactId>dubbo-serialization-native-hessian</artifactId>
+ <version>${native-hessian.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>${jmh.version}</version>