You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by al...@apache.org on 2021/09/09 14:50:18 UTC
[dubbo-go-samples] branch config-enhance updated: add complex
service java samples to rpc/dubbo (#235)
This is an automated email from the ASF dual-hosted git repository.
alexstocks pushed a commit to branch config-enhance
in repository https://gitbox.apache.org/repos/asf/dubbo-go-samples.git
The following commit(s) were added to refs/heads/config-enhance by this push:
new 68e7ae7 add complex service java samples to rpc/dubbo (#235)
68e7ae7 is described below
commit 68e7ae7e4b08b6fd6e35f66e947f01f35ee472e1
Author: Mulavar <97...@qq.com>
AuthorDate: Thu Sep 9 22:50:11 2021 +0800
add complex service java samples to rpc/dubbo (#235)
* add complex service java samples to rpc/dubbo
* add complex service to java-server-2.7
* rm 2.6
Co-authored-by: dongjianhui03 <do...@meituan.com>
---
.run/rpc/dubbo/rpc-dubbo-go-client.run.xml | 15 ++
rpc/dubbo/README.md | 10 +-
rpc/dubbo/go-server/cmd/server.go | 2 +
rpc/dubbo/go-server/conf/dubbogo.yml | 31 +--
rpc/dubbo/go-server/pkg/complex_service.go | 111 ++++++++++
rpc/dubbo/java-client/2.6/pom.xml | 79 -------
rpc/dubbo/java-client/2.6/run.sh | 2 -
.../resources/META-INF/spring/dubbo.consumer.xml | 41 ----
rpc/dubbo/java-client/2.7/run.sh | 2 -
.../src/main/java/org/apache/dubbo/Consumer.java | 227 ---------------------
.../2.7/src/main/java/org/apache/dubbo/User.java | 83 --------
.../main/java/org/apache/dubbo/UserProvider.java | 27 ---
rpc/dubbo/{java-server/2.7 => java-client}/pom.xml | 29 ++-
rpc/dubbo/java-client/run.sh | 2 +
.../main/java/org/apache/dubbo/ComplexData.java} | 36 +++-
.../java/org/apache/dubbo/ComplexProvider.java} | 51 ++---
.../src/main/java/org/apache/dubbo/Consumer.java | 59 +++++-
.../src/main/java/org/apache/dubbo/Gender.java | 46 ++---
.../src/main/java/org/apache/dubbo/User.java | 169 +++++++--------
.../main/java/org/apache/dubbo/UserProvider.java | 54 ++---
.../resources/META-INF/spring/dubbo.consumer.xml | 0
.../{2.7 => }/src/main/resources/log4j.properties | 0
rpc/dubbo/java-server/2.6/pom.xml | 79 -------
rpc/dubbo/java-server/2.6/run.sh | 2 -
.../src/main/java/org/apache/dubbo/Response.java | 92 ---------
.../2.6/src/main/java/org/apache/dubbo/User.java | 95 ---------
.../main/java/org/apache/dubbo/UserProvider.java | 52 -----
.../org/apache/dubbo/UserProviderAnotherImpl.java | 147 -------------
.../java/org/apache/dubbo/UserProviderImpl.java | 119 -----------
.../2.6/src/main/resources/log4j.properties | 20 --
rpc/dubbo/java-server/2.7/run.sh | 2 -
.../resources/META-INF/spring/dubbo.provider.xml | 36 ----
.../2.7/src/main/resources/log4j.properties | 20 --
rpc/dubbo/{java-client/2.7 => java-server}/pom.xml | 22 +-
rpc/dubbo/java-server/run.sh | 2 +
.../main/java/org/apache/dubbo/ComplexData.java | 37 ++++
.../java/org/apache/dubbo/ComplexProvider.java} | 51 ++---
.../java/org/apache/dubbo/ComplexProviderImpl.java | 61 ++++++
.../src/main/java/org/apache/dubbo/Gender.java | 46 ++---
.../src/main/java/org/apache/dubbo/Provider.java | 20 ++
.../src/main/java/org/apache/dubbo/Response.java | 0
.../src/main/java/org/apache/dubbo/User.java | 190 ++++++++---------
.../main/java/org/apache/dubbo/UserProvider.java | 0
.../org/apache/dubbo/UserProviderAnotherImpl.java | 0
.../java/org/apache/dubbo/UserProviderImpl.java | 0
.../resources/META-INF/spring/dubbo.provider.xml | 72 +++----
.../src/main/resources/log4j.properties | 1 +
rpc/triple/hessian2/java-client/run.sh | 4 +-
48 files changed, 745 insertions(+), 1501 deletions(-)
diff --git a/.run/rpc/dubbo/rpc-dubbo-go-client.run.xml b/.run/rpc/dubbo/rpc-dubbo-go-client.run.xml
new file mode 100644
index 0000000..0327b87
--- /dev/null
+++ b/.run/rpc/dubbo/rpc-dubbo-go-client.run.xml
@@ -0,0 +1,15 @@
+<component name="ProjectRunConfigurationManager">
+ <configuration default="false" name="rpc-dubbo-go-client" type="GoApplicationRunConfiguration" factoryName="Go Application">
+ <module name="dubbo-go-samples" />
+ <working_directory value="$PROJECT_DIR$" />
+ <envs>
+ <env name="DUBBO_GO_CONFIG_PATH" value="$PROJECT_DIR$/rpc/dubbo/go-client/conf/dubbogo.yml" />
+ <env name="APP_LOG_CONF_FILE" value="$PROJECT_DIR$/rpc/dubbo/go-client/conf/log.yml" />
+ </envs>
+ <kind value="PACKAGE" />
+ <package value="github.com/apache/dubbo-go-samples/rpc/dubbo/go-client/cmd" />
+ <directory value="$PROJECT_DIR$" />
+ <filePath value="$PROJECT_DIR$/rpc/dubbo/go-client/cmd/client.go" />
+ <method v="2" />
+ </configuration>
+</component>
\ No newline at end of file
diff --git a/rpc/dubbo/README.md b/rpc/dubbo/README.md
index c2c7fdc..0757b21 100644
--- a/rpc/dubbo/README.md
+++ b/rpc/dubbo/README.md
@@ -3,9 +3,11 @@
For api definition and go client and server startup, please refer to [dubbo-go 3.0 quickstart](https://dubbogo.github.io/zh-cn/docs/user/quickstart/3.0/quickstart.html)
## Instructions
-1. Start zookeeper
-
-2. Start the server
+### 1. Start zookeeper
+Execute the command `docker run --rm -p 2181:2181 zookeeper` or `make -f $DUBBO_GO_SAMPLES_ROOT_PATH/build/Makefile docker-up`.
+ If you choose the second way, please ensure that you have set the environment $DUBBO_GO_SAMPLES_ROOT_PATH.
+
+### 2. Start the server
Use goland to start rpc-dubbo-go-server
@@ -13,7 +15,7 @@ or
Execute `sh run.sh` in the java-server folder to start the java server
-3. Start the client
+### 3. Start the client
Use goland to start rpc-dubbo-go-client
diff --git a/rpc/dubbo/go-server/cmd/server.go b/rpc/dubbo/go-server/cmd/server.go
index 7c038e5..54dc26c 100644
--- a/rpc/dubbo/go-server/cmd/server.go
+++ b/rpc/dubbo/go-server/cmd/server.go
@@ -48,6 +48,8 @@ func main() {
hessian.RegisterJavaEnum(pkg.Gender(pkg.MAN))
hessian.RegisterJavaEnum(pkg.Gender(pkg.WOMAN))
hessian.RegisterPOJO(&pkg.User{})
+ config.SetProviderService(&pkg.UserProvider{})
+ config.SetProviderService(&pkg.ComplexProvider{})
// ------------
config.Load()
diff --git a/rpc/dubbo/go-server/conf/dubbogo.yml b/rpc/dubbo/go-server/conf/dubbogo.yml
index 622609d..8793c27 100644
--- a/rpc/dubbo/go-server/conf/dubbogo.yml
+++ b/rpc/dubbo/go-server/conf/dubbogo.yml
@@ -2,25 +2,28 @@
dubbo:
registries:
- "demoZK":
- protocol: "zookeeper"
- timeout: "3s"
- address: "127.0.0.1:2181"
+ demoZK:
+ protocol: zookeeper
+ timeout: 3s
+ address: 127.0.0.1:2181
protocols:
- "dubbo":
- name: "dubbo"
+ dubbo:
+ name: dubbo
port: 20000
provider:
registry:
- demoZK
services:
- "UserProvider":
- protocol: "dubbo"
- interface: "org.apache.dubbo.UserProvider"
- loadbalance: "random"
- warmup: "100"
- cluster: "failover"
+ UserProvider:
+ protocol: dubbo
+ interface: org.apache.dubbo.UserProvider
+ loadbalance: random
+ warmup: 100
+ cluster: failover
methods:
- - name: "GetUser"
+ - name: GetUser
retries: 1
- loadbalance: "random"
+ loadbalance: random
+ ComplexProvider:
+ protocol: dubbo
+ interface: org.apache.dubbo.ComplexProvider
diff --git a/rpc/dubbo/go-server/pkg/complex_service.go b/rpc/dubbo/go-server/pkg/complex_service.go
new file mode 100644
index 0000000..cecd9b0
--- /dev/null
+++ b/rpc/dubbo/go-server/pkg/complex_service.go
@@ -0,0 +1,111 @@
+/*
+ * 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 pkg
+
+import (
+ "context"
+)
+
+import (
+ "dubbo.apache.org/dubbo-go/v3/common/logger"
+)
+
+type ComplexData struct {
+ BooleanData bool
+
+ StringData string
+
+ //UIntData uint
+ UInt8Data uint8
+ UInt16Data uint16
+ UInt32Data uint32
+ UInt64Data uint64
+
+ IntData int
+ Int8Data int8
+ Int16Data int16
+ Int32Data int32
+ Int64Data int64
+
+ StringStringMapData map[string]string
+ //StringIntMapData map[string]int
+ //StringUIntMapData map[string]uint32
+ //IntStringMapData map[int]string
+ //StringUserDefinedMapData map[string]User
+ StringUserDefinedPtrMapData map[string]*User
+
+ UserDefinedData User
+ UserDefinedDataPtr *User
+
+ ByteData []byte
+
+ ArrayListData []string
+ ArrayUserDefinedData []User
+ ArrayUserDefinedPtrData []*User
+}
+
+func (u *ComplexData) JavaClassName() string {
+ return "org.apache.dubbo.ComplexData"
+}
+
+type ComplexProvider struct {
+}
+
+func (u *ComplexProvider) InvokeWithMultiBasicData(ctx context.Context, str string, data []byte, num int32, boolValue bool) (int32, error) {
+ logger.Info("InvokeWithMultiBasicData", str, " ", data, " ", num, " ", boolValue)
+ return num, nil
+}
+
+func (u *ComplexProvider) InvokeWithEmptyReq(ctx context.Context) error {
+ logger.Info("InvokeWithEmptyReq")
+ return nil
+}
+
+func (u *ComplexProvider) InvokeWithSingleString(ctx context.Context, req string) error {
+ logger.Infof("InvokeWithSingleString, req = %s", req)
+ return nil
+}
+
+func (u *ComplexProvider) InvokeWithMultiString(ctx context.Context, req, req2, req3 string) error {
+ logger.Info("InvokeWithMultiString, req = ", req, req2, req3)
+ return nil
+}
+
+func (u *ComplexProvider) InvokeWithStringList(ctx context.Context, req []string) error {
+ logger.Infof("InvokeWithStringList, req = %s", req)
+ return nil
+}
+
+func (u *ComplexProvider) InvokeWithEmptyReqStringRsp(ctx context.Context) (string, error) {
+ logger.Infof("InvokeWithEmptyReqStringRsp")
+ return "success rsp", nil
+}
+
+func (u *ComplexProvider) InvokeWithEmptyReqMultiStringRsp(ctx context.Context) (string, string, string, error) {
+ logger.Infof("InvokeWithEmptyReqMultiStringRsp")
+ return "success rsp1", "success rsp2", "success rsp3", nil
+}
+
+func (u *ComplexProvider) InvokeWithComplexReqComplexRspPtr(ctx context.Context, req *ComplexData) (*ComplexData, error) {
+ logger.Infof("InvokeWithComplexReqComplexRsp req = %+v", req)
+ return req, nil
+}
+
+func (u *ComplexProvider) Reference() string {
+ return "ComplexProvider"
+}
diff --git a/rpc/dubbo/java-client/2.6/pom.xml b/rpc/dubbo/java-client/2.6/pom.xml
deleted file mode 100644
index 908dfdb..0000000
--- a/rpc/dubbo/java-client/2.6/pom.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?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">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.dubbo</groupId>
- <artifactId>2.6</artifactId>
- <version>0.0.1</version>
-
- <properties>
- <skip_maven_deploy>false</skip_maven_deploy>
- <dubbo-version>2.6.5</dubbo-version>
- <curator.version>2.12.0</curator.version>
- <zk.version>3.4.14</zk.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
-
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <exclusions>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>4.1.25.Final</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>${curator.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.26</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.10.0</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.10.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- <exclusions>
- <exclusion>
- <artifactId>org.apache.zookeeper</artifactId>
- <groupId>zookeeper</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>${zk.version}</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
diff --git a/rpc/dubbo/java-client/2.6/run.sh b/rpc/dubbo/java-client/2.6/run.sh
deleted file mode 100644
index df4e2f7..0000000
--- a/rpc/dubbo/java-client/2.6/run.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-mvn install -DSkipTests
-mvn exec:java -Dexec.mainClass="org.apache.dubbo.Consumer"
\ No newline at end of file
diff --git a/rpc/dubbo/java-client/2.6/src/main/resources/META-INF/spring/dubbo.consumer.xml b/rpc/dubbo/java-client/2.6/src/main/resources/META-INF/spring/dubbo.consumer.xml
deleted file mode 100644
index 8205f66..0000000
--- a/rpc/dubbo/java-client/2.6/src/main/resources/META-INF/spring/dubbo.consumer.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-<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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
-
- <!-- 消费方应用名,用于计算依赖关系,不是匹配条件,不要与提供方一样 -->
- <dubbo:application name="user-info-client" />
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="dubbogo" address="zookeeper://127.0.0.1:2181" />
- <!-- dubbo.registry.address from dubbo.properties -->
- <!-- dubbo:registry address="${dubbo.registry.address}" / -->
-
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol id="dubbo" name="dubbo" />
-
- <!-- 声明需要使用的服务接口 -->
- <dubbo:reference registry="dubbogo" check="false" id="userProvider" protocol="dubbo" interface="org.apache.dubbo.UserProvider">
- <!--<dubbo:parameter key="heartbeat" value="10000"/ -->
- </dubbo:reference>
-
- <dubbo:reference registry="dubbogo" check="false" id="userProvider1" protocol="dubbo" version="2.0" interface="org.apache.dubbo.UserProvider">
- </dubbo:reference>
- <dubbo:reference registry="dubbogo" check="false" id="userProvider2" protocol="dubbo" version="2.0" group="as" interface="org.apache.dubbo.UserProvider">
- </dubbo:reference>
-</beans>
diff --git a/rpc/dubbo/java-client/2.7/run.sh b/rpc/dubbo/java-client/2.7/run.sh
deleted file mode 100644
index df4e2f7..0000000
--- a/rpc/dubbo/java-client/2.7/run.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-mvn install -DSkipTests
-mvn exec:java -Dexec.mainClass="org.apache.dubbo.Consumer"
\ No newline at end of file
diff --git a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/Consumer.java b/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/Consumer.java
deleted file mode 100644
index c339ad4..0000000
--- a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/Consumer.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- * 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 org.apache.dubbo;
-
-import com.alibaba.dubbo.rpc.service.EchoService;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-public class Consumer {
- // Define a private variable (Required in Spring)
- private static UserProvider userProvider;
- private static UserProvider userProvider1;
- private static UserProvider userProvider2;
-
- public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo.consumer.xml"});
- userProvider = (UserProvider)context.getBean("userProvider");
- userProvider1 = (UserProvider)context.getBean("userProvider1");
- userProvider2 = (UserProvider)context.getBean("userProvider2");
-
- start();
- }
-
- // Start the entry function for consumer (Specified in the configuration file)
- public static void start() throws Exception {
- System.out.println("\n\ntest");
- testGetUser();
- testGetUsers();
- System.out.println("\n\ntest1");
- testGetUser1();
- testGetUsers1();
- System.out.println("\n\ntest2");
- testGetUser2();
- testGetUsers2();
- Thread.sleep(2000);
- }
-
- private static void testGetUser() throws Exception {
- try {
- EchoService echoService = (EchoService)userProvider;
- Object status = echoService.$echo("OK");
- System.out.println("echo: "+status);
- User user1 = userProvider.GetUser("A003");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user1.getId() + ", name:" + user1.getName() + ", sex:" + user1.getSex().toString()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
- User user2 = userProvider.GetUser0("A003","Moorse");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user2.getId() + ", name:" + user2.getName() + ", sex:" + user2.getSex().toString()
- + ", age:" + user2.getAge() + ", time:" + user2.getTime().toString());
- User user3 = userProvider.getUser(1);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user3.getId() + ", name:" + user3.getName() + ", sex:" + user3.getSex().toString()
- + ", age:" + user3.getAge() + ", time:" + user3.getTime());
- User user4 = userProvider.getUser(1, "name");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user4.getId() + ", name:" + user4.getName() + ", sex:" + user4.getSex().toString()
- + ", age:" + user4.getAge() + ", time:" + user4.getTime());
- userProvider.GetUser3();
- System.out.println("GetUser3 succ");
-
- User user9 = userProvider.GetUser1("A003");
- } catch (Throwable e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- try {
- userProvider.GetErr("A003");
- } catch (Throwable t) {
- System.out.println("*************exception***********");
- t.printStackTrace();
- }
- }
-
- private static void testGetUsers() throws Exception {
- try {
- List<String> userIDList = new ArrayList<String>();
- userIDList.add("A001");
- userIDList.add("A002");
- userIDList.add("A003");
-
- List<User> userList = userProvider.GetUsers(userIDList);
-
- for (int i = 0; i < userList.size(); i++) {
- User user = userList.get(i);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static void testGetUser1() throws Exception {
- try {
- EchoService echoService = (EchoService)userProvider1;
- Object status = echoService.$echo("OK");
- System.out.println("echo: "+status);
- User user1 = userProvider1.GetUser("A003");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user1.getId() + ", name:" + user1.getName() + ", sex:" + user1.getSex().toString()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
- User user2 = userProvider1.GetUser0("A003","Moorse");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user2.getId() + ", name:" + user2.getName() + ", sex:" + user2.getSex().toString()
- + ", age:" + user2.getAge() + ", time:" + user2.getTime().toString());
- User user3 = userProvider1.getUser(1);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user3.getId() + ", name:" + user3.getName() + ", sex:" + user3.getSex().toString()
- + ", age:" + user3.getAge() + ", time:" + user3.getTime());
- User user4 = userProvider1.getUser(1, "name");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user4.getId() + ", name:" + user4.getName() + ", sex:" + user4.getSex().toString()
- + ", age:" + user4.getAge() + ", time:" + user4.getTime());
- userProvider1.GetUser3();
- System.out.println("GetUser3 succ");
-
- User user9 = userProvider1.GetUser1("A003");
- } catch (Throwable e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- try {
- userProvider1.GetErr("A003");
- } catch (Throwable t) {
- System.out.println("*************exception***********");
- t.printStackTrace();
- }
- }
-
- private static void testGetUsers1() throws Exception {
- try {
- List<String> userIDList = new ArrayList<String>();
- userIDList.add("A001");
- userIDList.add("A002");
- userIDList.add("A003");
-
- List<User> userList = userProvider1.GetUsers(userIDList);
-
- for (int i = 0; i < userList.size(); i++) {
- User user = userList.get(i);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private static void testGetUser2() throws Exception {
- try {
- EchoService echoService = (EchoService)userProvider2;
- Object status = echoService.$echo("OK");
- System.out.println("echo: "+status);
- User user1 = userProvider2.GetUser("A003");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user1.getId() + ", name:" + user1.getName() + ", sex:" + user1.getSex().toString()
- + ", age:" + user1.getAge() + ", time:" + user1.getTime().toString());
- User user2 = userProvider2.GetUser0("A003","Moorse");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user2.getId() + ", name:" + user2.getName() + ", sex:" + user2.getSex().toString()
- + ", age:" + user2.getAge() + ", time:" + user2.getTime().toString());
- User user3 = userProvider2.getUser(1);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user3.getId() + ", name:" + user3.getName() + ", sex:" + user3.getSex().toString()
- + ", age:" + user3.getAge() + ", time:" + user3.getTime());
- User user4 = userProvider2.getUser(1, "name");
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user4.getId() + ", name:" + user4.getName() + ", sex:" + user4.getSex().toString()
- + ", age:" + user4.getAge() + ", time:" + user4.getTime());
- userProvider2.GetUser3();
- System.out.println("GetUser3 succ");
-
- User user9 = userProvider2.GetUser1("A003");
- } catch (Throwable e) {
- System.out.println("*************exception***********");
- e.printStackTrace();
- }
- try {
- userProvider2.GetErr("A003");
- } catch (Throwable t) {
- System.out.println("*************exception***********");
- t.printStackTrace();
- }
- }
-
- private static void testGetUsers2() throws Exception {
- try {
- List<String> userIDList = new ArrayList<String>();
- userIDList.add("A001");
- userIDList.add("A002");
- userIDList.add("A003");
-
- List<User> userList = userProvider2.GetUsers(userIDList);
-
- for (int i = 0; i < userList.size(); i++) {
- User user = userList.get(i);
- System.out.println("[" + new SimpleDateFormat("HH:mm:ss").format(new Date()) + "] " +
- " UserInfo, ID:" + user.getId() + ", name:" + user.getName() + ", sex:" + user.getSex().toString()
- + ", age:" + user.getAge() + ", time:" + user.getTime().toString());
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/User.java b/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/User.java
deleted file mode 100644
index 1d950db..0000000
--- a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/User.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * 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 org.apache.dubbo;
-
-import java.util.Date;
-
-public class User {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
- private Gender sex = Gender.MAN;
-
- public User() {
- }
-
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public Gender getSex() {
- return sex;
- }
-
- public void setSex(Gender sex) {
- this.sex = sex;
- }
-}
diff --git a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/UserProvider.java b/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/UserProvider.java
deleted file mode 100644
index d4bbb84..0000000
--- a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/UserProvider.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Licensed 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 org.apache.dubbo;
-
-import java.util.List;
-
-public interface UserProvider {
- User GetUser(String userId);
- User GetErr(String userId) throws Exception;
- User GetUser1(String userId) throws Exception;
- User getUser(int usercode);
- User getUser(int usercode, String name);
- void GetUser3();
- List<User> GetUsers(List<String> userIdList);
- User GetUser0(String userId, String name);
-}
diff --git a/rpc/dubbo/java-server/2.7/pom.xml b/rpc/dubbo/java-client/pom.xml
similarity index 85%
rename from rpc/dubbo/java-server/2.7/pom.xml
rename to rpc/dubbo/java-client/pom.xml
index 50dd888..8a56628 100644
--- a/rpc/dubbo/java-server/2.7/pom.xml
+++ b/rpc/dubbo/java-client/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.dubbo</groupId>
- <artifactId>2.7</artifactId>
+ <artifactId>java-client-2.7</artifactId>
<version>0.0.1</version>
<properties>
@@ -13,6 +13,7 @@
<dubbo-version>2.7.7</dubbo-version>
<curator.version>2.12.0</curator.version>
<zk.version>3.4.14</zk.version>
+ <java.version>1.8</java.version>
</properties>
<dependencies>
@@ -21,19 +22,21 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
-
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.10</version>
+ </dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
<version>${dubbo-version}</version>
</dependency>
-
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo-spring-boot-starter</artifactId>
<version>${dubbo-version}</version>
</dependency>
-
<dependency>
<groupId>org.apache.curator</groupId>
<artifactId>curator-framework</artifactId>
@@ -69,7 +72,6 @@
<artifactId>netty-all</artifactId>
<version>4.1.25.Final</version>
</dependency>
-
<dependency>
<groupId>jetty</groupId>
<artifactId>org.mortbay.jetty</artifactId>
@@ -95,7 +97,6 @@
<artifactId>jackson-databind</artifactId>
<version>2.10.0</version>
</dependency>
-
<dependency>
<groupId>com.github.sgroschupf</groupId>
<artifactId>zkclient</artifactId>
@@ -115,12 +116,24 @@
</exclusion>
</exclusions>
</dependency>
-
<dependency>
<groupId>org.apache.zookeeper</groupId>
<artifactId>zookeeper</artifactId>
<version>${zk.version}</version>
</dependency>
-
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
diff --git a/rpc/dubbo/java-client/run.sh b/rpc/dubbo/java-client/run.sh
new file mode 100644
index 0000000..5ad39b2
--- /dev/null
+++ b/rpc/dubbo/java-client/run.sh
@@ -0,0 +1,2 @@
+mvn clean install -DSkipTests
+mvn -e exec:java -Dexec.mainClass="org.apache.dubbo.Consumer"
\ No newline at end of file
diff --git a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Provider.java b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/ComplexData.java
similarity index 60%
rename from rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Provider.java
rename to rpc/dubbo/java-client/src/main/java/org/apache/dubbo/ComplexData.java
index 6545977..696c756 100644
--- a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Provider.java
+++ b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/ComplexData.java
@@ -17,18 +17,34 @@
package org.apache.dubbo;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
+import java.io.Serializable;
+import java.util.HashMap;
-public class Provider {
+import lombok.Data;
+@Data
+public class ComplexData implements Serializable {
/**
- * To get ipv6 address to work, add
- * System.setProperty("java.net.preferIPv6Addresses", "true");
- * before running your application.
+ * Base Type & String
*/
- public static void main(String[] args) throws Exception {
- ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo.provider.xml"});
- context.start();
- System.in.read(); // press any key to exit
- }
+ boolean booleanData;
+ String stringData;
+ short int16Data;
+ int intData;
+ long int64Data;
+
+ /**
+ * Array Type
+ */
+ byte [] byteData;
+ String[] arrayListData;
+
+ /**
+ * User Defined Type
+ */
+ User userDefinedData;
+ HashMap<String, String> stringStringHashMap;
+// HashMap<String, User> stringUserDefinedPtrMapData;
+// User[] arrayUserData;
+
}
diff --git a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Gender.java b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/ComplexProvider.java
similarity index 65%
rename from rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Gender.java
rename to rpc/dubbo/java-client/src/main/java/org/apache/dubbo/ComplexProvider.java
index 7b503cc..8f871ea 100644
--- a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Gender.java
+++ b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/ComplexProvider.java
@@ -1,23 +1,28 @@
-/*
- * 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 org.apache.dubbo;
-
-public enum Gender {
- MAN,
- WOMAN
-}
+/*
+ * 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 org.apache.dubbo;
+
+public interface ComplexProvider {
+ int InvokeWithMultiBasicData (String str, byte[]data, int num, boolean boolValue);
+ void InvokeWithSingleString(String req);
+ void InvokeWithMultiString(String str1, String str2, String str3);
+ void InvokeWithStringList(String[] req);
+ void InvokeWithEmptyReq();
+ String InvokeWithEmptyReqStringRsp ();
+ ComplexData InvokeWithComplexReqComplexRspPtr(ComplexData complexData);
+}
diff --git a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/Consumer.java b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/Consumer.java
similarity index 81%
rename from rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/Consumer.java
rename to rpc/dubbo/java-client/src/main/java/org/apache/dubbo/Consumer.java
index c339ad4..22c1e31 100644
--- a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/Consumer.java
+++ b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/Consumer.java
@@ -17,14 +17,19 @@
package org.apache.dubbo;
-import com.alibaba.dubbo.rpc.service.EchoService;
-import org.springframework.context.support.ClassPathXmlApplicationContext;
-
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
+import java.util.HashMap;
import java.util.List;
+import com.alibaba.dubbo.rpc.service.EchoService;
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ReferenceConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
public class Consumer {
// Define a private variable (Required in Spring)
private static UserProvider userProvider;
@@ -38,6 +43,7 @@ public class Consumer {
userProvider2 = (UserProvider)context.getBean("userProvider2");
start();
+ startComplexConsumerService();
}
// Start the entry function for consumer (Specified in the configuration file)
@@ -224,4 +230,51 @@ public class Consumer {
e.printStackTrace();
}
}
+
+ public static void startComplexConsumerService() {
+ ReferenceConfig<ComplexProvider> ref = new ReferenceConfig<>();
+ ref.setInterface(ComplexProvider.class);
+ ref.setCheck(false);
+ ref.setProtocol(CommonConstants.DUBBO_PROTOCOL);
+ ref.setLazy(true);
+ ref.setTimeout(100000);
+ ref.setApplication(new ApplicationConfig("demo-consumer"));
+
+ ref.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
+ final ComplexProvider complexProvider = ref.get();
+
+// complexProvider.invokeWithEmptyReq();
+// complexProvider.invokeWithSingleString("single string");
+// complexProvider.invokeWithMultiString("string1", "string2", "string3");
+// String [] strList = new String []{"first string"," second string"};
+// complexProvider.invokeWithStringList(strList );
+// String rsp = complexProvider.invokeWithEmptyReqStringRsp();
+// System.out.println("get rsp = "+ rsp);
+
+
+ ComplexData cpxData = new ComplexData();
+ cpxData.booleanData = true;
+ cpxData.stringData = "test string";
+ cpxData.byteData = new byte[] {1, 12, 4, 3, 3,3};
+ cpxData.int16Data =16;
+ cpxData.intData = 32;
+ cpxData.int64Data = 64;
+ cpxData.arrayListData = new String[]{"array1", "array2"};
+// cpxData.arrayUserData = new User[]{new User(), new User(), new User()};
+ cpxData.userDefinedData = new User();
+ cpxData.userDefinedData.setAge(18);
+ cpxData.userDefinedData.setId("iojfioj");
+ cpxData.stringStringHashMap = new HashMap<>();
+// cpxData.stringStringHashMap.put("key1", "value");
+// cpxData.stringStringHashMap.put("key2", "value");
+// cpxData.stringUserDefinedPtrMapData = new HashMap<>();
+// cpxData.stringUserDefinedPtrMapData.put("key1", new User());
+// cpxData.stringUserDefinedPtrMapData.put("key2", new User());
+
+// ComplexData response = complexProvider.invokeWithComplexReqComplexRspPtr(cpxData);
+// System.out.println("get complex = "+ response);
+
+ int rsp = complexProvider.InvokeWithMultiBasicData("str",new byte[]{1, 3, 4,6,7}, 32, true);
+ System.out.println("get multi basic rsp = "+ rsp);
+ }
}
diff --git a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/Gender.java b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/Gender.java
similarity index 97%
rename from rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/Gender.java
rename to rpc/dubbo/java-client/src/main/java/org/apache/dubbo/Gender.java
index 7b503cc..a016781 100644
--- a/rpc/dubbo/java-client/2.7/src/main/java/org/apache/dubbo/Gender.java
+++ b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/Gender.java
@@ -1,23 +1,23 @@
-/*
- * 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 org.apache.dubbo;
-
-public enum Gender {
- MAN,
- WOMAN
-}
+/*
+ * 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 org.apache.dubbo;
+
+public enum Gender {
+ MAN,
+ WOMAN
+}
diff --git a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/User.java b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/User.java
similarity index 95%
rename from rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/User.java
rename to rpc/dubbo/java-client/src/main/java/org/apache/dubbo/User.java
index 1d950db..ba383c6 100644
--- a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/User.java
+++ b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/User.java
@@ -1,83 +1,86 @@
-/*
- * 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 org.apache.dubbo;
-
-import java.util.Date;
-
-public class User {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
- private Gender sex = Gender.MAN;
-
- public User() {
- }
-
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public Gender getSex() {
- return sex;
- }
-
- public void setSex(Gender sex) {
- this.sex = sex;
- }
-}
+/*
+ * 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 org.apache.dubbo;
+
+import java.util.Date;
+
+import lombok.Data;
+
+@Data
+public class User {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+ private Gender sex = Gender.MAN;
+
+ public User() {
+ }
+
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+ public Gender getSex() {
+ return sex;
+ }
+
+ public void setSex(Gender sex) {
+ this.sex = sex;
+ }
+}
diff --git a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/UserProvider.java b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/UserProvider.java
similarity index 97%
rename from rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/UserProvider.java
rename to rpc/dubbo/java-client/src/main/java/org/apache/dubbo/UserProvider.java
index d4bbb84..1c8af6b 100644
--- a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/UserProvider.java
+++ b/rpc/dubbo/java-client/src/main/java/org/apache/dubbo/UserProvider.java
@@ -1,27 +1,27 @@
-/*
- * Licensed 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 org.apache.dubbo;
-
-import java.util.List;
-
-public interface UserProvider {
- User GetUser(String userId);
- User GetErr(String userId) throws Exception;
- User GetUser1(String userId) throws Exception;
- User getUser(int usercode);
- User getUser(int usercode, String name);
- void GetUser3();
- List<User> GetUsers(List<String> userIdList);
- User GetUser0(String userId, String name);
-}
+/*
+ * Licensed 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 org.apache.dubbo;
+
+import java.util.List;
+
+public interface UserProvider {
+ User GetUser(String userId);
+ User GetErr(String userId) throws Exception;
+ User GetUser1(String userId) throws Exception;
+ User getUser(int usercode);
+ User getUser(int usercode, String name);
+ void GetUser3();
+ List<User> GetUsers(List<String> userIdList);
+ User GetUser0(String userId, String name);
+}
diff --git a/rpc/dubbo/java-client/2.7/src/main/resources/META-INF/spring/dubbo.consumer.xml b/rpc/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
similarity index 100%
rename from rpc/dubbo/java-client/2.7/src/main/resources/META-INF/spring/dubbo.consumer.xml
rename to rpc/dubbo/java-client/src/main/resources/META-INF/spring/dubbo.consumer.xml
diff --git a/rpc/dubbo/java-client/2.7/src/main/resources/log4j.properties b/rpc/dubbo/java-client/src/main/resources/log4j.properties
similarity index 100%
rename from rpc/dubbo/java-client/2.7/src/main/resources/log4j.properties
rename to rpc/dubbo/java-client/src/main/resources/log4j.properties
diff --git a/rpc/dubbo/java-server/2.6/pom.xml b/rpc/dubbo/java-server/2.6/pom.xml
deleted file mode 100644
index 908dfdb..0000000
--- a/rpc/dubbo/java-server/2.6/pom.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-<?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">
- <modelVersion>4.0.0</modelVersion>
-
- <groupId>org.apache.dubbo</groupId>
- <artifactId>2.6</artifactId>
- <version>0.0.1</version>
-
- <properties>
- <skip_maven_deploy>false</skip_maven_deploy>
- <dubbo-version>2.6.5</dubbo-version>
- <curator.version>2.12.0</curator.version>
- <zk.version>3.4.14</zk.version>
- </properties>
-
- <dependencies>
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- <version>1.7.25</version>
- </dependency>
-
- <dependency>
- <groupId>com.alibaba</groupId>
- <artifactId>dubbo</artifactId>
- <version>${dubbo-version}</version>
- <exclusions>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>io.netty</groupId>
- <artifactId>netty-all</artifactId>
- <version>4.1.25.Final</version>
- </dependency>
- <dependency>
- <groupId>org.apache.curator</groupId>
- <artifactId>curator-framework</artifactId>
- <version>${curator.version}</version>
- </dependency>
-
- <dependency>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>jetty</artifactId>
- <version>6.1.26</version>
- </dependency>
-
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-core</artifactId>
- <version>2.10.0</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.10.0</version>
- </dependency>
-
- <dependency>
- <groupId>com.github.sgroschupf</groupId>
- <artifactId>zkclient</artifactId>
- <version>0.1</version>
- <exclusions>
- <exclusion>
- <artifactId>org.apache.zookeeper</artifactId>
- <groupId>zookeeper</groupId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.zookeeper</groupId>
- <artifactId>zookeeper</artifactId>
- <version>${zk.version}</version>
- </dependency>
- </dependencies>
-</project>
\ No newline at end of file
diff --git a/rpc/dubbo/java-server/2.6/run.sh b/rpc/dubbo/java-server/2.6/run.sh
deleted file mode 100644
index 9416b14..0000000
--- a/rpc/dubbo/java-server/2.6/run.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-mvn install -DSkipTests
-mvn exec:java -Dexec.mainClass="java.org.apache.dubbo.Provider"
\ No newline at end of file
diff --git a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Response.java b/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Response.java
deleted file mode 100644
index a8196c6..0000000
--- a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Response.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * 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 org.apache.dubbo;
-
-import java.io.Serializable;
-
-public final class Response<T> implements Serializable {
- private static final long serialVersionUID = 3727205004706510648L;
- public static final Integer OK = 200;
- public static final Integer ERR = 500;
- private Integer Status;
- private String Err;
- private T Data;
-
- public Response() {
- }
-
- public static <T> Response<T> ok() {
- Response r = new Response();
- r.Status = OK;
- return r;
- }
-
- public static <T> Response<T> ok(Object Data) {
- Response r = new Response();
- r.Status = OK;
- r.Data = Data;
- return r;
- }
-
- public static <T> Response<T> notOk(String Err) {
- Response r = new Response();
- r.Status = ERR;
- r.Err = Err;
- return r;
- }
-
- public static <T> Response<T> notOk(Integer Status, String Err) {
- Response r = new Response();
- r.Status = Status;
- r.Err = Err;
- return r;
- }
-
-// public Boolean isSuccess() {
-// return Objects.equals(this.Status, OK);
-// }
-
- public Integer getStatus() {
- return this.Status;
- }
-
- public void setStatus(Integer Status) {
- this.Status = Status;
- }
-
- public String getErr() {
- return this.Err;
- }
-
- public void setErr(String Err) {
- this.Err = Err;
- }
-
- public T getData() {
- return this.Data;
- }
-
- public void setData(T Data) {
- this.Status = OK;
- this.Data = Data;
- }
-
- public String toString() {
- return "Response{Status=" + this.Status + ", Err='" + this.Err + '\'' + ", Data=" + this.Data + '}';
- }
-}
\ No newline at end of file
diff --git a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/User.java b/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/User.java
deleted file mode 100644
index 7fcfa38..0000000
--- a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/User.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * 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 org.apache.dubbo;
-
-import java.io.Serializable;
-import java.util.Date;
-
-public class User implements Serializable {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
- private Gender sex = Gender.MAN;
-
- public User() {
- }
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public User(String id, String name, int age, Date time, Gender sex) {
- this.id = id;
- this.name = name;
- this.age = age;
- this.time = time;
- this.sex = sex;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public Gender getSex() {
- return sex;
- }
-
- public void setSex(Gender sex) {
- this.sex = sex;
- }
-
- public String toString() {
- return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time + ", gender:" + sex + "}";
- }
-}
diff --git a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProvider.java b/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProvider.java
deleted file mode 100644
index 0e62224..0000000
--- a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProvider.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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 org.apache.dubbo;
-
-import java.util.List;
-import java.util.Map;
-
-public interface UserProvider {
-
- boolean isLimit(Gender gender, String name);
-
- User GetUser(String userId); // the first alpha is Upper case to compatible with golang.
-
- List<User> GetUsers(List<String> userIdList);
-
- Integer GetGender(Integer gender);
-
- void GetUser3();
-
- User GetUser0(String userId, String name);
-
- User GetErr(String userId) throws Exception;
-
- Map<String, User> GetUserMap(List<String> userIdList);
-
- User getUser(int usercode);
-
- User getUser(int usercode, String name);
-
- User queryUser(User user);
-
- Map<String, User> queryAll();
-
- int Calc(int a, int b);
-
- Response<Integer> Sum(int a, int b);
-}
diff --git a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProviderAnotherImpl.java b/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProviderAnotherImpl.java
deleted file mode 100644
index 9d41811..0000000
--- a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProviderAnotherImpl.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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 org.apache.dubbo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-public class UserProviderAnotherImpl implements UserProvider {
- // private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
- private static final Logger logger = LoggerFactory.getLogger("userLogger"); // Output to com.dubbogo.user-server.log
-
- private Map<String, User> userMap = new HashMap<String, User>();
-
- public UserProviderAnotherImpl() {
- // userMap.put("001", new User("001", "other-zhangsan", 18, new Date(1998-1900, 1, 2, 3, 4, 5), Gender.MAN));
- userMap.put("001", new User("001", "other-zhangsan", 18, new Date(0x12345678), Gender.MAN));
- userMap.put("002", new User("002", "other-lisi", 20, new Date(1996-1900, 1, 2, 3, 4, 5), Gender.MAN));
- userMap.put("003", new User("003", "other-lily", 23, new Date(1993-1900, 1, 2, 3, 4, 5), Gender.WOMAN));
- userMap.put("004", new User("004", "other-lisa", 32, new Date(1985-1900, 1, 2, 3, 4, 5), Gender.WOMAN));
- }
-
- public boolean isLimit(Gender gender, String name) {
- logger.info(String.format("input gender=%sand name=%s", gender, name));
- return Gender.MAN == gender;
- }
-
- public User GetUser(String userId) {
- logger.info("input userId = " + userId);
- return new User(userId, "Joe", 48);
- }
-
- public User GetUser0(String userId, String name) {
- return new User(userId, name, 48);
- }
-
- public void GetUser3() {
- logger.info("this is GetUser3 of another");
- }
-
- public User GetErr(String userId) throws Exception {
- throw new Exception("exception");
- }
-
- public List<User> GetUsers(ArrayList<String> userIdList) {
- Iterator it = userIdList.iterator();
- List<User> userList = new ArrayList<User>();
- logger.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- logger.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- userList.add(userMap.get(id));
- logger.info("id:" + id + ", com.dubbogo.user:" + userMap.get(id));
- }
- }
-
- return userList;
- }
-
- public Map<String, User> GetUserMap(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- Map<String, User> map = new HashMap<String, User>();
- logger.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- logger.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- map.put(id, userMap.get(id));
- logger.info("id:" + id + ", com.dubbogo.user:" + userMap.get(id));
- }
- }
-
- return map;
- }
-
- public List<User> GetUsers(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- List<User> userList = new ArrayList<User>();
- logger.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- logger.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- userList.add(userMap.get(id));
- logger.info("id:" + id + ", com.dubbogo.user:" + userMap.get(id));
- }
- }
-
- return userList;
- }
-
- public Integer GetGender(Integer gender) {
- return gender != null && gender == 1 ? 1 : 0;
- }
-
- // @Override
- public User getUser(int userCode) {
- logger.info("input userCode = " + userCode);
- return new User(String.valueOf(userCode), "userCode get", 48);
- }
-
- public User getUser(int usercode, String name) {
- return new User(String.valueOf(usercode), name, 18);
- }
-
- public User queryUser(User user) {
- logger.info("input com.dubbogo.user = " + user);
- return new User(user.getId(), "get:" + user.getName(), user.getAge() + 18);
- }
-
- public Map<String, User> queryAll() {
- logger.info("input");
- Map<String, User> map = new HashMap<String, User>();
- map.put("001", new User("001", "Joe", 18));
- map.put("002", new User("002", "Wen", 20));
-
- return map;
- }
-
- public int Calc(int a,int b) {
- return a + b + 100;
- }
-
- public Response<Integer> Sum(int a,int b) {
- return Response.ok(a+b);
- }
-}
diff --git a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProviderImpl.java b/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProviderImpl.java
deleted file mode 100644
index 73747eb..0000000
--- a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/UserProviderImpl.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/*
- * 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 org.apache.dubbo;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.*;
-
-public class UserProviderImpl implements UserProvider {
- // private static final Logger logger = LoggerFactory.getLogger(getClass()); // Only output to dubbo's log(logs/server.log)
- private static final Logger LOG = LoggerFactory.getLogger("UserLogger"); // Output to com.dubbogo.user-server.log
- Map<String, User> userMap = new HashMap<String, User>();
-
- public UserProviderImpl() {
- userMap.put("A001", new User("A001", "demo-zhangsan", 18));
- userMap.put("A002", new User("A002", "demo-lisi", 20));
- userMap.put("A003", new User("A003", "demo-lily", 23));
- userMap.put("A004", new User("A004", "demo-lisa", 32));
- }
-
- public boolean isLimit(Gender gender, String name) {
- return Gender.WOMAN == gender;
- }
-
- public User GetUser(String userId) {
- return new User(userId, "zhangsan", 18);
- }
-
- public User GetErr(String userId) throws Exception {
- throw new Exception("exception");
- }
-
- public User GetUser0(String userId, String name) {
- return new User(userId, name, 18);
- }
-
- public List<User> GetUsers(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- List<User> userList = new ArrayList<User>();
- LOG.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- LOG.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- userList.add(userMap.get(id));
- LOG.info("id:" + id + ", com.dubbogo.user:" + userMap.get(id));
- }
- }
-
- return userList;
- }
-
- public Integer GetGender(Integer gender) {
- return gender != null && gender == 1 ? 1 : 0;
- }
-
- public void GetUser3() {
- LOG.info("this is GetUser3 of impl");
- }
-
- public Map<String, User> GetUserMap(List<String> userIdList) {
- Iterator it = userIdList.iterator();
- Map<String, User> map = new HashMap<String, User>();
- LOG.warn("@userIdList size:" + userIdList.size());
-
- while(it.hasNext()) {
- String id = (String)(it.next());
- LOG.info("GetUsers(@uid:" + id + ")");
- if (userMap.containsKey(id)) {
- map.put(id, userMap.get(id));
- LOG.info("id:" + id + ", com.dubbogo.user:" + userMap.get(id));
- }
- }
-
- return map;
- }
-
- public User queryUser(User user) {
- return new User(user.getId(), "hello:" +user.getName(), user.getAge() + 18);
- }
-
- public Map<String, User> queryAll() {
- return userMap;
- }
-
-
- public User getUser(int userCode) {
- return new User(String.valueOf(userCode), "userCode get", 48);
- }
-
- public User getUser(int usercode, String name) {
- return new User(String.valueOf(usercode), name, 38);
- }
-
- public int Calc(int a,int b) {
- return a + b;
- }
-
- public Response<Integer> Sum(int a,int b) {
- return Response.ok(a+b);
- }
-}
diff --git a/rpc/dubbo/java-server/2.6/src/main/resources/log4j.properties b/rpc/dubbo/java-server/2.6/src/main/resources/log4j.properties
deleted file mode 100644
index 13c8049..0000000
--- a/rpc/dubbo/java-server/2.6/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
diff --git a/rpc/dubbo/java-server/2.7/run.sh b/rpc/dubbo/java-server/2.7/run.sh
deleted file mode 100644
index 9416b14..0000000
--- a/rpc/dubbo/java-server/2.7/run.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-mvn install -DSkipTests
-mvn exec:java -Dexec.mainClass="java.org.apache.dubbo.Provider"
\ No newline at end of file
diff --git a/rpc/dubbo/java-server/2.7/src/main/resources/META-INF/spring/dubbo.provider.xml b/rpc/dubbo/java-server/2.7/src/main/resources/META-INF/spring/dubbo.provider.xml
deleted file mode 100644
index cd63653..0000000
--- a/rpc/dubbo/java-server/2.7/src/main/resources/META-INF/spring/dubbo.provider.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- <!-- 应用名 -->
- <dubbo:application name="user-info-server"/>
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="dubbogo" address="zookeeper://127.0.0.1:2181" />
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010" />
- <!-- 声明需要暴露的服务接口 -->
- <dubbo:service id="aaa" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="demoService"/>
- <dubbo:service id="bbb" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="otherService" version="2.0"/>
- <dubbo:service id="ccc" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="otherService" group="as" version="2.0"/>
-
- <bean id="demoService" class="org.apache.dubbo.UserProviderImpl" />
- <bean id="otherService" class="org.apache.dubbo.UserProviderAnotherImpl"/>
-
-</beans>
diff --git a/rpc/dubbo/java-server/2.7/src/main/resources/log4j.properties b/rpc/dubbo/java-server/2.7/src/main/resources/log4j.properties
deleted file mode 100644
index 13c8049..0000000
--- a/rpc/dubbo/java-server/2.7/src/main/resources/log4j.properties
+++ /dev/null
@@ -1,20 +0,0 @@
-## Logger configure file for myproject
-log.dir=logs/
-datestamp=yyyy-MM-dd/HH:mm:ss.SSS
-
-log4j.rootLogger=DEBUG, file, console
-
-log4j.appender.file=org.apache.log4j.DailyRollingFileAppender
-log4j.appender.file.threshold=DEBUG
-log4j.appender.file.File=${log.dir}/log4j.log
-log4j.appender.file.DatePattern=-yyyyMMddHH
-log4j.appender.file.ImmediateFlush=true
-log4j.appender.file.Append=true
-log4j.appender.file.layout=org.apache.log4j.PatternLayout
-log4j.appender.file.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
-log4j.appender.console=org.apache.log4j.ConsoleAppender
-log4j.appender.console.Threshold=DEBUG
-log4j.appender.console.layout=org.apache.log4j.PatternLayout
-log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
-
diff --git a/rpc/dubbo/java-client/2.7/pom.xml b/rpc/dubbo/java-server/pom.xml
similarity index 86%
rename from rpc/dubbo/java-client/2.7/pom.xml
rename to rpc/dubbo/java-server/pom.xml
index 50dd888..edf1f77 100644
--- a/rpc/dubbo/java-client/2.7/pom.xml
+++ b/rpc/dubbo/java-server/pom.xml
@@ -5,7 +5,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.dubbo</groupId>
- <artifactId>2.7</artifactId>
+ <artifactId>java-server-2.7</artifactId>
<version>0.0.1</version>
<properties>
@@ -21,7 +21,11 @@
<artifactId>slf4j-api</artifactId>
<version>1.7.25</version>
</dependency>
-
+ <dependency>
+ <groupId>org.projectlombok</groupId>
+ <artifactId>lombok</artifactId>
+ <version>1.18.10</version>
+ </dependency>
<dependency>
<groupId>org.apache.dubbo</groupId>
<artifactId>dubbo</artifactId>
@@ -123,4 +127,18 @@
</dependency>
</dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.1</version>
+ <configuration>
+ <source>${java.version}</source>
+ <target>${java.version}</target>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
</project>
\ No newline at end of file
diff --git a/rpc/dubbo/java-server/run.sh b/rpc/dubbo/java-server/run.sh
new file mode 100644
index 0000000..555d1b3
--- /dev/null
+++ b/rpc/dubbo/java-server/run.sh
@@ -0,0 +1,2 @@
+mvn clean install -DSkipTests
+mvn -e exec:java -Dexec.mainClass="java.org.apache.dubbo.Provider"
\ No newline at end of file
diff --git a/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexData.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexData.java
new file mode 100644
index 0000000..2c93861
--- /dev/null
+++ b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexData.java
@@ -0,0 +1,37 @@
+package org.apache.dubbo;
+
+import java.io.Serializable;
+import java.util.HashMap;
+
+public class ComplexData implements Serializable {
+ boolean booleanData;
+ String stringData;
+
+ short int16Data;
+ int intData;
+ long int64Data;
+
+ User userDefinedData;
+ byte [] byteData;
+ HashMap<String, String> stringStringHashMap;
+ HashMap<String, User> stringUserDefinedPtrMapData;
+ String[] arrayListData;
+ User[] arrayUserData;
+
+ public String GetString(){
+ String result = "";
+ result += booleanData;
+ result += stringData;
+ result += int16Data;
+ result += intData;
+ result += int64Data;
+ result += userDefinedData;
+ result += byteData;
+ result += stringStringHashMap;
+ result += stringUserDefinedPtrMapData;
+ result += arrayUserData;
+ result += arrayListData;
+ return result;
+ }
+
+}
diff --git a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Gender.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexProvider.java
similarity index 65%
rename from rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Gender.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexProvider.java
index 7b503cc..dc449e0 100644
--- a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Gender.java
+++ b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexProvider.java
@@ -1,23 +1,28 @@
-/*
- * 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 org.apache.dubbo;
-
-public enum Gender {
- MAN,
- WOMAN
-}
+/*
+ * 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 org.apache.dubbo;
+
+public interface ComplexProvider {
+ int InvokeWithMultiBasicData(String str, byte[] data, int num, boolean boolValue);
+ void InvokeWithSingleString(String req);
+ void InvokeWithMultiString(String str1, String str2, String str3);
+ void InvokeWithStringList(String[] req);
+ void InvokeWithEmptyReq();
+ String InvokeWithEmptyReqStringRsp();
+ ComplexData InvokeWithComplexReqComplexRspPtr(ComplexData complexData);
+}
diff --git a/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexProviderImpl.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexProviderImpl.java
new file mode 100644
index 0000000..ffd5a6f
--- /dev/null
+++ b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/ComplexProviderImpl.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 org.apache.dubbo;
+
+import java.util.Arrays;
+
+public class ComplexProviderImpl implements ComplexProvider {
+ @Override
+ public int InvokeWithMultiBasicData(String str, byte[] data, int num, boolean boolValue) {
+ System.out.println("InvokeWithMultiBasicData, str: " + str + ", data: " + Arrays.toString(data) + ", num: " + num + ", boolValue:" +
+ " " + boolValue);
+ return num;
+ }
+
+ @Override
+ public void InvokeWithEmptyReq() {
+ System.out.println("InvokeWithEmptyReq");
+ }
+
+ @Override
+ public void InvokeWithSingleString(String req) {
+ System.out.println("InvokeWithEmptyReq" + req);
+ }
+
+ @Override
+ public void InvokeWithStringList(String[] req) {
+ System.out.println("InvokeWithEmptyReq" + req);
+ }
+
+ @Override
+ public void InvokeWithMultiString(String str1, String str2, String str3) {
+ System.out.println("InvokeWithEmptyReq" + str1 + str2 + str3);
+ }
+
+ @Override
+ public String InvokeWithEmptyReqStringRsp() {
+ System.out.println("InvokeWithEmptyReq");
+ return "invoke success";
+ }
+
+ @Override
+ public ComplexData InvokeWithComplexReqComplexRspPtr(ComplexData complexData) {
+ System.out.println("InvokeWithComplexReqComplexRspPtr = "+ complexData.GetString());
+ return complexData;
+ }
+}
diff --git a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/Gender.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Gender.java
similarity index 97%
rename from rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/Gender.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Gender.java
index 7b503cc..a016781 100644
--- a/rpc/dubbo/java-client/2.6/src/main/java/org/apache/dubbo/Gender.java
+++ b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Gender.java
@@ -1,23 +1,23 @@
-/*
- * 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 org.apache.dubbo;
-
-public enum Gender {
- MAN,
- WOMAN
-}
+/*
+ * 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 org.apache.dubbo;
+
+public enum Gender {
+ MAN,
+ WOMAN
+}
diff --git a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Provider.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Provider.java
similarity index 59%
rename from rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Provider.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Provider.java
index 6545977..ab96df8 100644
--- a/rpc/dubbo/java-server/2.6/src/main/java/org/apache/dubbo/Provider.java
+++ b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Provider.java
@@ -17,6 +17,13 @@
package org.apache.dubbo;
+import java.util.concurrent.CountDownLatch;
+
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.config.ApplicationConfig;
+import org.apache.dubbo.config.ProtocolConfig;
+import org.apache.dubbo.config.RegistryConfig;
+import org.apache.dubbo.config.ServiceConfig;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class Provider {
@@ -29,6 +36,19 @@ public class Provider {
public static void main(String[] args) throws Exception {
ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/dubbo.provider.xml"});
context.start();
+ startComplexService();
System.in.read(); // press any key to exit
}
+
+ public static void startComplexService() throws InterruptedException {
+ ServiceConfig<ComplexProvider> service = new ServiceConfig<>();
+ service.setInterface(ComplexProvider.class);
+ service.setRef(new ComplexProviderImpl());
+ service.setProtocol(new ProtocolConfig(CommonConstants.DUBBO_PROTOCOL, 20001));
+ service.setApplication(new ApplicationConfig("demo-provider"));
+ service.setRegistry(new RegistryConfig("zookeeper://127.0.0.1:2181"));
+ service.export();
+ System.out.println("dubbo service started");
+ new CountDownLatch(1).await();
+ }
}
diff --git a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Response.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Response.java
similarity index 100%
rename from rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/Response.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/Response.java
diff --git a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/User.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/User.java
similarity index 95%
rename from rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/User.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/User.java
index 7fcfa38..039a883 100644
--- a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/User.java
+++ b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/User.java
@@ -1,95 +1,95 @@
-/*
- * 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 org.apache.dubbo;
-
-import java.io.Serializable;
-import java.util.Date;
-
-public class User implements Serializable {
-
- private String id;
-
- private String name;
-
- private int age;
-
- private Date time = new Date();
-
- private Gender sex = Gender.MAN;
-
- public User() {
- }
-
- public User(String id, String name, int age) {
- this.id = id;
- this.name = name;
- this.age = age;
- }
-
- public User(String id, String name, int age, Date time, Gender sex) {
- this.id = id;
- this.name = name;
- this.age = age;
- this.time = time;
- this.sex = sex;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAge() {
- return age;
- }
-
- public void setAge(int age) {
- this.age = age;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public Gender getSex() {
- return sex;
- }
-
- public void setSex(Gender sex) {
- this.sex = sex;
- }
-
- public String toString() {
- return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time + ", gender:" + sex + "}";
- }
-}
+/*
+ * 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 org.apache.dubbo;
+
+import java.io.Serializable;
+import java.util.Date;
+
+public class User implements Serializable {
+
+ private String id;
+
+ private String name;
+
+ private int age;
+
+ private Date time = new Date();
+
+ private Gender sex = Gender.MAN;
+
+ public User() {
+ }
+
+ public User(String id, String name, int age) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ }
+
+ public User(String id, String name, int age, Date time, Gender sex) {
+ this.id = id;
+ this.name = name;
+ this.age = age;
+ this.time = time;
+ this.sex = sex;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getAge() {
+ return age;
+ }
+
+ public void setAge(int age) {
+ this.age = age;
+ }
+
+ public Date getTime() {
+ return time;
+ }
+
+ public void setTime(Date time) {
+ this.time = time;
+ }
+
+ public Gender getSex() {
+ return sex;
+ }
+
+ public void setSex(Gender sex) {
+ this.sex = sex;
+ }
+
+ public String toString() {
+ return "User{id:" + id + ", name:" + name + ", age:" + age + ", time:" + time + ", gender:" + sex + "}";
+ }
+}
diff --git a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/UserProvider.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/UserProvider.java
similarity index 100%
rename from rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/UserProvider.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/UserProvider.java
diff --git a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/UserProviderAnotherImpl.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/UserProviderAnotherImpl.java
similarity index 100%
rename from rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/UserProviderAnotherImpl.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/UserProviderAnotherImpl.java
diff --git a/rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/UserProviderImpl.java b/rpc/dubbo/java-server/src/main/java/org/apache/dubbo/UserProviderImpl.java
similarity index 100%
rename from rpc/dubbo/java-server/2.7/src/main/java/org/apache/dubbo/UserProviderImpl.java
rename to rpc/dubbo/java-server/src/main/java/org/apache/dubbo/UserProviderImpl.java
diff --git a/rpc/dubbo/java-server/2.6/src/main/resources/META-INF/spring/dubbo.provider.xml b/rpc/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
similarity index 98%
rename from rpc/dubbo/java-server/2.6/src/main/resources/META-INF/spring/dubbo.provider.xml
rename to rpc/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
index cd63653..efad8af 100644
--- a/rpc/dubbo/java-server/2.6/src/main/resources/META-INF/spring/dubbo.provider.xml
+++ b/rpc/dubbo/java-server/src/main/resources/META-INF/spring/dubbo.provider.xml
@@ -1,36 +1,36 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Licensed 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.
--->
-
-<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"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
-
- <!-- 应用名 -->
- <dubbo:application name="user-info-server"/>
- <!-- 连接到哪个本地注册中心 -->
- <dubbo:registry id="dubbogo" address="zookeeper://127.0.0.1:2181" />
- <!-- 用dubbo协议在20880端口暴露服务 -->
- <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010" />
- <!-- 声明需要暴露的服务接口 -->
- <dubbo:service id="aaa" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="demoService"/>
- <dubbo:service id="bbb" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="otherService" version="2.0"/>
- <dubbo:service id="ccc" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="otherService" group="as" version="2.0"/>
-
- <bean id="demoService" class="org.apache.dubbo.UserProviderImpl" />
- <bean id="otherService" class="org.apache.dubbo.UserProviderAnotherImpl"/>
-
-</beans>
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed 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.
+-->
+
+<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"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+ http://code.alibabatech.com/schema/dubbo http://code.alibabatech.com/schema/dubbo/dubbo.xsd">
+
+ <!-- 应用名 -->
+ <dubbo:application name="user-info-server"/>
+ <!-- 连接到哪个本地注册中心 -->
+ <dubbo:registry id="dubbogo" address="zookeeper://127.0.0.1:2181" />
+ <!-- 用dubbo协议在20880端口暴露服务 -->
+ <dubbo:protocol id="dubbo" name="dubbo" host="127.0.0.1" port="20010" />
+ <!-- 声明需要暴露的服务接口 -->
+ <dubbo:service id="aaa" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="demoService"/>
+ <dubbo:service id="bbb" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="otherService" version="2.0"/>
+ <dubbo:service id="ccc" registry="dubbogo" timeout="3000" interface="org.apache.dubbo.UserProvider" ref="otherService" group="as" version="2.0"/>
+
+ <bean id="demoService" class="org.apache.dubbo.UserProviderImpl" />
+ <bean id="otherService" class="org.apache.dubbo.UserProviderAnotherImpl"/>
+
+</beans>
diff --git a/rpc/dubbo/java-client/2.6/src/main/resources/log4j.properties b/rpc/dubbo/java-server/src/main/resources/log4j.properties
similarity index 99%
rename from rpc/dubbo/java-client/2.6/src/main/resources/log4j.properties
rename to rpc/dubbo/java-server/src/main/resources/log4j.properties
index 06bcb34..806e33d 100644
--- a/rpc/dubbo/java-client/2.6/src/main/resources/log4j.properties
+++ b/rpc/dubbo/java-server/src/main/resources/log4j.properties
@@ -17,3 +17,4 @@ log4j.appender.console=org.apache.log4j.ConsoleAppender
log4j.appender.console.Threshold=DEBUG
log4j.appender.console.layout=org.apache.log4j.PatternLayout
log4j.appender.console.layout.ConversionPattern=%d{${datestamp}} %5p: %l - %m%n
+
diff --git a/rpc/triple/hessian2/java-client/run.sh b/rpc/triple/hessian2/java-client/run.sh
index 5152f3a..946b97e 100644
--- a/rpc/triple/hessian2/java-client/run.sh
+++ b/rpc/triple/hessian2/java-client/run.sh
@@ -1,2 +1,2 @@
-mvn install -DSkipTests
-mvn exec:java -Dexec.mainClass="com.apache.dubbo.sample.basic.ApiConsumer"
\ No newline at end of file
+mvn clean install -DSkipTests
+mvn -e exec:java -Dexec.mainClass="com.apache.dubbo.sample.basic.ApiConsumer"
\ No newline at end of file