Skip to content
Permalink
Browse files
native hessian
  • Loading branch information
beiwei30 committed May 29, 2018
1 parent 26e86b5 commit c1e29216b4bb391cbd3259719a90c30b94e6e9e1
Showing 8 changed files with 147 additions and 4 deletions.
@@ -33,3 +33,6 @@ hs_err_pid*

# jmh output
*.json

# dubbo-serialization-native-hessian git repo
dubbo-serialization-native-hessian/
@@ -5,6 +5,12 @@ usage() {
}

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
}

@@ -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 @@ public static void main(String[] args) {
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));
}
}
@@ -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>
@@ -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>
@@ -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>
@@ -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>
11 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,14 +26,16 @@

<modules>
<module>benchmark-base</module>
<module>server-base</module>
<module>client-base</module>
<module>dubbo-kryo-client</module>
<module>dubbo-kryo-server</module>
<module>dubbo-hessianlite-client</module>
<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>
@@ -96,6 +99,12 @@
<version>${fst.version}</version>
</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>

0 comments on commit c1e2921

Please sign in to comment.