diff --git a/.gitignore b/.gitignore
index af3d4f9128b..3b9e19e1c5b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,7 @@ target/
*.iws
# temp ignore
+log.*
*.log
*.cache
*.diff
diff --git a/README.md b/README.md
index 8be6642a82d..cb9cf50c15f 100644
--- a/README.md
+++ b/README.md
@@ -32,6 +32,8 @@ Dubbox adds features like RESTful remoting, Kyro/FST serialization, etc to the p
* **修正了dubbo的bug** 包括配置、序列化、管理界面等等的bug。
+* **支持原生thrift、avro等跨语言的rpc框架**(2.8.4a版开始支持),只是非java语言的client调用dubbo的thrift/avro服务时,consumer无法享受dubbo的治理功能
+
**注:dubbox和dubbo 2.x是兼容的,没有改变dubbo的任何已有的功能和配置方式(除了升级了spring之类的版本)**
## 文档资料
@@ -70,6 +72,16 @@ Dubbox adds features like RESTful remoting, Kyro/FST serialization, etc to the p
* 修正Dubbo管理界面中没有consumer时出现空指针异常(马金凯)
* 修正@Reference annotation中protocol设置不起作用的bug(沈理)
* 修正@Reference annotation放在setter方法上即会出错的bug(Dylan)
+* **dubbox-2.8.4a**:
+ * 升级spring到4.x,其它一些依赖组件也一并进行了版本升级(杨俊明)
+ * 增加log4j2支持,原来一些硬编码依赖log4j的代码,改为依赖slf4j,以便兼容其它一些主流日志组件(杨俊明)
+ * 增加原生thrift支持,升级thrift到0.9.3,为避免与dubbo原来的thrift实现命名冲突,新增的原生thrift协议,协议名称改为thrift2(杨俊明)
+ * 增加hadoop avro支持(杨俊明)
+* **dubbox-2.8.5**:
+ * 编译时去掉了一些不常用的模块,以加快项目整体的编译速度(杨俊明)
+ * 增加了google-gRPC-1.0.1的支持,目前仅处于“玩票”阶段,生产环境请慎用(杨俊明)
+ * 重写了dubbo-demo模块,提供了rest/dubbo/avro/thrift/grpc五种协议的基本示例(杨俊明)
+ * 将zkclient 0.8.1加入项目中,避免大家编译时,要先去pull另一个项目(杨俊明)
## 依赖
diff --git a/dubbo-admin/pom.xml b/dubbo-admin/pom.xml
index ec2a30be84a..7336b3616c9 100644
--- a/dubbo-admin/pom.xml
+++ b/dubbo-admin/pom.xml
@@ -1,12 +1,12 @@
- 4.0.0
-
- com.alibaba
- dubbo-parent
- 2.8.4
-
- dubbo-admin
- war
- ${project.artifactId}
- The admin module of dubbo project
-
- 1.5
- /
- false
- false
-
-
-
- com.alibaba
- dubbo
- ${project.parent.version}
-
-
- com.alibaba.citrus
- citrus-webx-all
-
-
- org.javassist
- javassist
-
-
- io.netty
- netty
-
-
- org.apache.mina
- mina-core
-
-
- org.glassfish.grizzly
- grizzly-core
-
-
- org.apache.httpcomponents
- httpclient
-
-
- com.alibaba
- fastjson
-
-
- com.thoughtworks.xstream
- xstream
-
-
- org.apache.bsf
- bsf-api
-
-
- org.apache.zookeeper
- zookeeper
-
-
- com.github.sgroschupf
- zkclient
-
-
- org.apache.curator
- curator-framework
-
-
- com.googlecode.xmemcached
- xmemcached
-
-
- org.apache.thrift
- libthrift
-
-
- com.caucho
- hessian
-
-
- javax.servlet
- javax.servlet-api
- provided
-
-
- log4j
- log4j
-
-
- org.slf4j
- slf4j-api
-
-
- org.slf4j
- slf4j-log4j12
-
-
- redis.clients
- jedis
-
-
- javax.validation
- validation-api
-
-
- org.hibernate
- hibernate-validator
-
-
- javax.cache
- cache-api
-
-
-
-
-
- org.mortbay.jetty
- maven-jetty-plugin
- ${jetty_version}
-
- /
- 10
-
-
- 8080
- 60000
-
-
-
-
-
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ 4.0.0
+
+ com.alibaba
+ dubbo-parent
+
+ 2.8.4a
+
+ dubbo-admin
+ war
+ ${project.artifactId}
+ The admin module of dubbo project
+
+ 1.5
+ /
+ false
+ false
+ 8.1.15.v20140411
+ 3.2.16.RELEASE
+
+
+
+ com.alibaba
+ dubbo
+ ${project.parent.version}
+
+
+ com.alibaba.citrus
+ citrus-webx-all
+
+
+ org.javassist
+ javassist
+
+
+ io.netty
+ netty
+
+
+ org.apache.mina
+ mina-core
+
+
+ org.glassfish.grizzly
+ grizzly-core
+
+
+ org.apache.httpcomponents
+ httpclient
+
+
+ com.alibaba
+ fastjson
+
+
+ com.thoughtworks.xstream
+ xstream
+
+
+ org.apache.bsf
+ bsf-api
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+ com.alibaba
+ zkclient
+
+
+ org.apache.curator
+ curator-framework
+
+
+ com.googlecode.xmemcached
+ xmemcached
+
+
+ org.apache.thrift
+ libthrift
+
+
+ com.caucho
+ hessian
+
+
+ javax.servlet
+ javax.servlet-api
+ provided
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-api
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ redis.clients
+ jedis
+
+
+ javax.validation
+ validation-api
+
+
+ org.hibernate
+ hibernate-validator
+
+
+ javax.cache
+ cache-api
+
+
+ org.apache.velocity
+ velocity
+
+
+
+
+
+
+ org.apache.tomcat.maven
+ tomcat7-maven-plugin
+ 2.2
+
+ 8080
+ /
+
+
+
+ org.mortbay.jetty
+ jetty-maven-plugin
+ ${maven-jetty-plugin_version}
+
+
+
+ 8080
+
+
+ exit
+ 9090
+ 10
+
+ /${project.artifactId}
+
+
+
+
+
+
+
diff --git a/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/common/module/screen/Restful.java b/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/common/module/screen/Restful.java
index f5d385dbaf0..cb7ad262424 100644
--- a/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/common/module/screen/Restful.java
+++ b/dubbo-admin/src/main/java/com/alibaba/dubbo/governance/web/common/module/screen/Restful.java
@@ -7,6 +7,14 @@
*/
package com.alibaba.dubbo.governance.web.common.module.screen;
+import com.alibaba.dubbo.common.utils.CompatibleTypeUtils;
+import com.alibaba.dubbo.governance.biz.common.i18n.MessageResourceService;
+import com.alibaba.dubbo.governance.web.common.pulltool.RootContextPath;
+import com.alibaba.dubbo.governance.web.util.WebConstants;
+import com.alibaba.dubbo.registry.common.domain.User;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
import java.lang.reflect.Array;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -14,89 +22,79 @@
import java.util.Map;
import java.util.regex.Pattern;
-import org.apache.log4j.Logger;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import com.alibaba.dubbo.common.utils.CompatibleTypeUtils;
-import com.alibaba.dubbo.governance.biz.common.i18n.MessageResourceService;
-import com.alibaba.dubbo.governance.web.common.pulltool.RootContextPath;
-import com.alibaba.dubbo.governance.web.util.WebConstants;
-import com.alibaba.dubbo.registry.common.domain.User;
-
/**
* BaseScreen
- *
+ *
* @author william.liangf
*/
public abstract class Restful {
-
- protected static final Logger logger = Logger.getLogger(Restful.class);
-
- protected static final Pattern SPACE_SPLIT_PATTERN = Pattern.compile("\\s+");
-
- @Autowired
- private MessageResourceService messageResourceService;
-
- public String getMessage(String key, Object... args) {
- return messageResourceService.getMessage(key, args);
- }
-
- //FIXME 把这些辅助方法提取出去
- protected String role = null;
- protected String operator = null;
- protected User currentUser = null;
- protected String operatorAddress = null;
- protected String currentRegistry = null;
-
+
+ protected static final Logger logger = LoggerFactory.getLogger(Restful.class);
+
+ protected static final Pattern SPACE_SPLIT_PATTERN = Pattern.compile("\\s+");
+
+ @Autowired
+ private MessageResourceService messageResourceService;
+
+ public String getMessage(String key, Object... args) {
+ return messageResourceService.getMessage(key, args);
+ }
+
+ //FIXME 把这些辅助方法提取出去
+ protected String role = null;
+ protected String operator = null;
+ protected User currentUser = null;
+ protected String operatorAddress = null;
+ protected String currentRegistry = null;
+
public void execute(Map context) throws Throwable {
- if(context.get(WebConstants.CURRENT_USER_KEY)!=null){
- User user = (User) context.get(WebConstants.CURRENT_USER_KEY);
- currentUser = user;
- operator = user.getUsername();
- role = user.getRole();
- context.put(WebConstants.CURRENT_USER_KEY, user);
+ if (context.get(WebConstants.CURRENT_USER_KEY) != null) {
+ User user = (User) context.get(WebConstants.CURRENT_USER_KEY);
+ currentUser = user;
+ operator = user.getUsername();
+ role = user.getRole();
+ context.put(WebConstants.CURRENT_USER_KEY, user);
}
- operatorAddress = (String)context.get("request.remoteHost");
+ operatorAddress = (String) context.get("request.remoteHost");
context.put("operator", operator);
- context.put("operatorAddress", operatorAddress);
-
+ context.put("operatorAddress", operatorAddress);
+
context.put("currentRegistry", currentRegistry);
-
+
String httpMethod = (String) context.get("request.method");
String method = (String) context.get("_method");
String contextPath = (String) context.get("request.contextPath");
context.put("rootContextPath", new RootContextPath(contextPath));
-
+
// 分析Method
if (method == null || method.length() == 0) {
String id = (String) context.get("id");
- if(id == null || id.length() == 0) {
+ if (id == null || id.length() == 0) {
method = "index";
- }
- else {
+ } else {
method = "show";
}
}
if ("index".equals(method)) {
- if("post".equalsIgnoreCase(httpMethod)) {
+ if ("post".equalsIgnoreCase(httpMethod)) {
method = "create";
}
} else if ("show".equals(method)) {
- if("put".equalsIgnoreCase(httpMethod) || "post".equalsIgnoreCase(httpMethod)) { // 因表单不能提交PUT请求,用POST代替
+ if ("put".equalsIgnoreCase(httpMethod) || "post".equalsIgnoreCase(httpMethod)) { // 因表单不能提交PUT请求,用POST代替
method = "update";
} else if ("delete".equalsIgnoreCase(httpMethod)) { // 因表单不能提交DELETE请求,用参数代替
method = "delete";
}
}
context.put("_method", method);
-
+
try {
Method m = null;
try {
m = getClass().getMethod(method, new Class>[]{Map.class});
} catch (NoSuchMethodException e) {
for (Method mtd : getClass().getMethods()) {
- if (Modifier.isPublic(mtd.getModifiers())
+ if (Modifier.isPublic(mtd.getModifiers())
&& mtd.getName().equals(method)) {
m = mtd;
break;
@@ -109,8 +107,8 @@ public void execute(Map context) throws Throwable {
if (m.getParameterTypes().length > 2) {
throw new IllegalStateException("Unsupport restful method " + m);
} else if (m.getParameterTypes().length == 2
- && (m.getParameterTypes()[0].equals(Map.class)
- || ! m.getParameterTypes()[1].equals(Map.class))) {
+ && (m.getParameterTypes()[0].equals(Map.class)
+ || !m.getParameterTypes()[1].equals(Map.class))) {
throw new IllegalStateException("Unsupport restful method " + m);
}
Object r;
@@ -128,13 +126,13 @@ public void execute(Map context) throws Throwable {
String id = (String) context.get("id");
String[] ids = id == null ? new String[0] : id.split("[.+]+");
value = Array.newInstance(t.getComponentType(), ids.length);
- for (int i = 0; i < ids.length; i ++) {
+ for (int i = 0; i < ids.length; i++) {
Array.set(value, i, convertPrimitive(t.getComponentType(), ids[i]));
}
} else {
value = t.newInstance();
for (Method mtd : t.getMethods()) {
- if (Modifier.isPublic(mtd.getModifiers())
+ if (Modifier.isPublic(mtd.getModifiers())
&& mtd.getName().startsWith("set")
&& mtd.getParameterTypes().length == 1) {
String p = mtd.getName().substring(3, 4).toLowerCase() + mtd.getName().substring(4);
@@ -147,39 +145,39 @@ public void execute(Map context) throws Throwable {
}
}
if (v != null) {
- try {
- mtd.invoke(value, new Object[] { CompatibleTypeUtils.compatibleTypeConvert(v, mtd.getParameterTypes()[0]) });
- } catch (Throwable e) {
- logger.warn(e.getMessage(), e);
- }
+ try {
+ mtd.invoke(value, new Object[]{CompatibleTypeUtils.compatibleTypeConvert(v, mtd.getParameterTypes()[0])});
+ } catch (Throwable e) {
+ logger.warn(e.getMessage(), e);
+ }
}
}
}
}
if (m.getParameterTypes().length == 1) {
- r = m.invoke(this, new Object[] {value});
+ r = m.invoke(this, new Object[]{value});
} else {
- r = m.invoke(this, new Object[] {value, context});
+ r = m.invoke(this, new Object[]{value, context});
}
}
if (m.getReturnType() == boolean.class || m.getReturnType() == Boolean.class) {
context.put("rundata.layout", "redirect");
context.put("rundata.target", "redirect");
context.put("success", r == null || ((Boolean) r).booleanValue());
- if(context.get("redirect")==null){
- context.put("redirect", getDefaultRedirect(context, method));
+ if (context.get("redirect") == null) {
+ context.put("redirect", getDefaultRedirect(context, method));
}
} else if (m.getReturnType() == String.class) {
String redirect = (String) r;
if (redirect == null) {
redirect = getDefaultRedirect(context, method);
}
-
- if(context.get("chain")!=null){
- context.put("rundata.layout", "home");
+
+ if (context.get("chain") != null) {
+ context.put("rundata.layout", "home");
context.put("rundata.target", "home");
- }else{
- context.put("rundata.redirect", redirect);
+ } else {
+ context.put("rundata.redirect", redirect);
}
} else {
context.put("rundata.layout", method);
@@ -200,14 +198,14 @@ public void execute(Map context) throws Throwable {
// context.put("redirect", getDefaultRedirect(context, method));
}
}
-
- private static boolean isPrimitive(Class> cls) {
- return cls.isPrimitive()|| cls == Boolean.class || cls == Byte.class
+
+ private static boolean isPrimitive(Class> cls) {
+ return cls.isPrimitive() || cls == Boolean.class || cls == Byte.class
|| cls == Character.class || cls == Short.class || cls == Integer.class
|| cls == Long.class || cls == Float.class || cls == Double.class
|| cls == String.class;
}
-
+
private static Object convertPrimitive(Class> cls, String value) {
if (cls == boolean.class || cls == Boolean.class) {
return value == null || value.length() == 0 ? false : Boolean.valueOf(value);
@@ -228,10 +226,10 @@ private static Object convertPrimitive(Class> cls, String value) {
}
return value;
}
-
+
private String getDefaultRedirect(Map context, String operate) {
String defaultRedirect = (String) context.get("defaultRedirect");
- return defaultRedirect;
+ return defaultRedirect;
}
-
+
}
diff --git a/dubbo-admin/src/main/webapp/WEB-INF/applicationContext.xml b/dubbo-admin/src/main/webapp/WEB-INF/applicationContext.xml
new file mode 100644
index 00000000000..142def25af2
--- /dev/null
+++ b/dubbo-admin/src/main/webapp/WEB-INF/applicationContext.xml
@@ -0,0 +1,6 @@
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-admin/src/main/webapp/WEB-INF/dubbo.properties b/dubbo-admin/src/main/webapp/WEB-INF/dubbo.properties
index c1ec1b3bc23..5b2d27c643e 100644
--- a/dubbo-admin/src/main/webapp/WEB-INF/dubbo.properties
+++ b/dubbo-admin/src/main/webapp/WEB-INF/dubbo.properties
@@ -1,3 +1,3 @@
-dubbo.registry.address=zookeeper://127.0.0.1:2181
+dubbo.registry.address=zookeeper://127.0.0.1:2181?backup=127.0.0.1:2182,127.0.0.1:2183
dubbo.admin.root.password=root
dubbo.admin.guest.password=guest
\ No newline at end of file
diff --git a/dubbo-admin/src/main/webapp/WEB-INF/log4j.xml b/dubbo-admin/src/main/webapp/WEB-INF/log4j.xml
index e0f2f4404a0..71b1b9b9109 100644
--- a/dubbo-admin/src/main/webapp/WEB-INF/log4j.xml
+++ b/dubbo-admin/src/main/webapp/WEB-INF/log4j.xml
@@ -1,29 +1,16 @@
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-cluster/pom.xml b/dubbo-cluster/pom.xml
index ec6af560cb0..20e2db2570b 100644
--- a/dubbo-cluster/pom.xml
+++ b/dubbo-cluster/pom.xml
@@ -19,7 +19,8 @@
com.alibaba
dubbo-parent
- 2.8.4
+
+ 2.8.5-SNAPSHOT
dubbo-cluster
jar
diff --git a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java
index d9bca59ef20..1e0e34120e8 100644
--- a/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java
+++ b/dubbo-cluster/src/main/java/com/alibaba/dubbo/rpc/cluster/router/condition/ConditionRouter.java
@@ -52,9 +52,9 @@ public class ConditionRouter implements Router, Comparable {
private final boolean force;
- private final Map whenCondition;
+ private final Map whenCondition; //消费端匹配
- private final Map thenCondition;
+ private final Map thenCondition; //提供端过滤
public ConditionRouter(URL url) {
this.url = url;
@@ -79,18 +79,39 @@ public ConditionRouter(URL url) {
}
}
+ public boolean hasWhenCondition() {
+ return whenCondition != null && whenCondition.size() > 0;
+ }
+
+ public boolean hasThenCondition() {
+ return thenCondition != null && thenCondition.size() > 0;
+ }
+
+ /**
+ * 路由规则逻辑
+ * 1. 必须同时配置 消费端匹配 和 提供端过滤
+ * 2. 消费端不匹配 返回所有 invoker
+ *
+ * @param invokers
+ * @param url refer url
+ * @param invocation
+ * @param
+ * @return
+ * @throws RpcException
+ */
public List> route(List> invokers, URL url, Invocation invocation)
throws RpcException {
if (invokers == null || invokers.size() == 0) {
return invokers;
}
try {
- if (! matchWhen(url)) {
+ //消费端匹配 如果不匹配 直接返回所有invoker
+ if (!matchWhen(url)) {
return invokers;
}
List> result = new ArrayList>();
- if (thenCondition == null) {
- logger.warn("The current consumer in the service blacklist. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey());
+ if (!hasThenCondition()) {
+ logger.warn("The current consumer in the service blacklist. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey());
return result;
}
for (Invoker invoker : invokers) {
@@ -101,8 +122,8 @@ public List> route(List> invokers, URL url, Invocation
if (result.size() > 0) {
return result;
} else if (force) {
- logger.warn("The route result is empty and force execute. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey() + ", router: " + url.getParameterAndDecoded(Constants.RULE_KEY));
- return result;
+ logger.warn("The route result is empty and force execute. consumer: " + NetUtils.getLocalHost() + ", service: " + url.getServiceKey() + ", router: " + url.getParameterAndDecoded(Constants.RULE_KEY));
+ return result;
}
} catch (Throwable t) {
logger.error("Failed to execute condition router rule: " + getUrl() + ", invokers: " + invokers + ", cause: " + t.getMessage(), t);
@@ -135,8 +156,14 @@ private boolean matchCondition(Map condition, URL url, URL pa
for (Map.Entry entry : sample.entrySet()) {
String key = entry.getKey();
MatchPair pair = condition.get(key);
- if (pair != null && ! pair.isMatch(entry.getValue(), param)) {
- return false;
+ if (param == null) {
+ if (pair != null && !pair.isMatch(entry.getValue())) {
+ return false;
+ }
+ } else {
+ if (pair != null && !pair.isMatch(entry.getValue(), param)) {
+ return false;
+ }
}
}
return true;
@@ -214,6 +241,7 @@ else if (",".equals(separator)) { // 如果为逗号表示
private static final class MatchPair {
final Set matches = new HashSet();
final Set mismatches = new HashSet();
+
public boolean isMatch(String value, URL param) {
for (String match : matches) {
if (! UrlUtils.isMatchGlobPattern(match, value, param)) {
@@ -227,5 +255,20 @@ public boolean isMatch(String value, URL param) {
}
return true;
}
+
+
+ public boolean isMatch(String value) {
+ for (String match : matches) {
+ if (!UrlUtils.isMatchGlobPattern(match, value)) {
+ return false;
+ }
+ }
+ for (String mismatch : mismatches) {
+ if (UrlUtils.isMatchGlobPattern(mismatch, value)) {
+ return false;
+ }
+ }
+ return true;
+ }
}
}
\ No newline at end of file
diff --git a/dubbo-common/pom.xml b/dubbo-common/pom.xml
index 0d5e9f761de..d156d50b4d8 100644
--- a/dubbo-common/pom.xml
+++ b/dubbo-common/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-parent
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-common
jar
@@ -43,6 +43,10 @@
log4j
log4j
+
+ org.apache.logging.log4j
+ log4j-core
+
org.javassist
javassist
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java
index 6a275e314c8..cdacfa06a75 100644
--- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/URL.java
@@ -235,6 +235,7 @@ public static URL valueOf(String url) {
url = url.substring(i + 1);
}
i = url.indexOf(":");
+ //fe80:0:0:0:fc83:51ff:fe41:9c76%9:20880 此处有bug,如果是ipv6就挂了
if (i >= 0 && i < url.length() - 1) {
port = Integer.parseInt(url.substring(i + 1));
url = url.substring(0, i);
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/LoggerFactory.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/LoggerFactory.java
index 3bb6addc10e..509e2d1be71 100644
--- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/LoggerFactory.java
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/LoggerFactory.java
@@ -1,154 +1,154 @@
-/*
- * Copyright 1999-2011 Alibaba Group.
- *
- * 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.
- */
+/*
+ * Copyright 1999-2011 Alibaba Group.
+ *
+ * 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 com.alibaba.dubbo.common.logger;
-import java.io.File;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
-import com.alibaba.dubbo.common.extension.ExtensionLoader;
-import com.alibaba.dubbo.common.logger.jcl.JclLoggerAdapter;
-import com.alibaba.dubbo.common.logger.jdk.JdkLoggerAdapter;
-import com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter;
-import com.alibaba.dubbo.common.logger.slf4j.Slf4jLoggerAdapter;
-import com.alibaba.dubbo.common.logger.support.FailsafeLogger;
+import com.alibaba.dubbo.common.extension.ExtensionLoader;
+import com.alibaba.dubbo.common.logger.jcl.JclLoggerAdapter;
+import com.alibaba.dubbo.common.logger.jdk.JdkLoggerAdapter;
+import com.alibaba.dubbo.common.logger.log4j.Log4jLoggerAdapter;
+import com.alibaba.dubbo.common.logger.log4j2.Log4j2LoggerAdapter;
+import com.alibaba.dubbo.common.logger.slf4j.Slf4jLoggerAdapter;
+import com.alibaba.dubbo.common.logger.support.FailsafeLogger;
+
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
/**
* 日志输出器工厂
- *
+ *
* @author william.liangf
*/
public class LoggerFactory {
- private LoggerFactory() {
- }
+ private LoggerFactory() {
+ }
+
+ private static volatile LoggerAdapter LOGGER_ADAPTER;
+
+ private static final ConcurrentMap LOGGERS = new ConcurrentHashMap();
+
+ // 查找常用的日志框架
+ static {
+ String logger = System.getProperty("dubbo.application.logger");
+ if ("slf4j".equals(logger)) {
+ setLoggerAdapter(new Slf4jLoggerAdapter());
+ } else if ("jcl".equals(logger)) {
+ setLoggerAdapter(new JclLoggerAdapter());
+ } else if ("log4j".equals(logger)) {
+ setLoggerAdapter(new Log4jLoggerAdapter());
+ } else if ("log4j2".equals(logger)) {
+ setLoggerAdapter(new Log4j2LoggerAdapter());
+ } else if ("jdk".equals(logger)) {
+ setLoggerAdapter(new JdkLoggerAdapter());
+ } else {
+ try {
+ setLoggerAdapter(new Log4j2LoggerAdapter());//默认日志类改成log4j2(杨俊明)
+ } catch (Throwable e1) {
+ try {
+ setLoggerAdapter(new Slf4jLoggerAdapter());
+ } catch (Throwable e2) {
+ try {
+ setLoggerAdapter(new JclLoggerAdapter());
+ } catch (Throwable e3) {
+ setLoggerAdapter(new JdkLoggerAdapter());
+ }
+ }
+ }
+ }
+ }
+
+ public static void setLoggerAdapter(String loggerAdapter) {
+ if (loggerAdapter != null && loggerAdapter.length() > 0) {
+ setLoggerAdapter(ExtensionLoader.getExtensionLoader(LoggerAdapter.class).getExtension(loggerAdapter));
+ }
+ }
- private static volatile LoggerAdapter LOGGER_ADAPTER;
-
- private static final ConcurrentMap LOGGERS = new ConcurrentHashMap();
+ /**
+ * 设置日志输出器供给器
+ *
+ * @param loggerAdapter 日志输出器供给器
+ */
+ public static void setLoggerAdapter(LoggerAdapter loggerAdapter) {
+ if (loggerAdapter != null) {
+ Logger logger = loggerAdapter.getLogger(LoggerFactory.class.getName());
+ logger.info("using logger: " + loggerAdapter.getClass().getName());
+ LoggerFactory.LOGGER_ADAPTER = loggerAdapter;
+ for (Map.Entry entry : LOGGERS.entrySet()) {
+ entry.getValue().setLogger(LOGGER_ADAPTER.getLogger(entry.getKey()));
+ }
+ }
+ }
- // 查找常用的日志框架
- static {
- String logger = System.getProperty("dubbo.application.logger");
- if ("slf4j".equals(logger)) {
- setLoggerAdapter(new Slf4jLoggerAdapter());
- } else if ("jcl".equals(logger)) {
- setLoggerAdapter(new JclLoggerAdapter());
- } else if ("log4j".equals(logger)) {
- setLoggerAdapter(new Log4jLoggerAdapter());
- } else if ("jdk".equals(logger)) {
- setLoggerAdapter(new JdkLoggerAdapter());
- } else {
- try {
- setLoggerAdapter(new Log4jLoggerAdapter());
- } catch (Throwable e1) {
- try {
- setLoggerAdapter(new Slf4jLoggerAdapter());
- } catch (Throwable e2) {
- try {
- setLoggerAdapter(new JclLoggerAdapter());
- } catch (Throwable e3) {
- setLoggerAdapter(new JdkLoggerAdapter());
- }
- }
- }
- }
- }
-
- public static void setLoggerAdapter(String loggerAdapter) {
- if (loggerAdapter != null && loggerAdapter.length() > 0) {
- setLoggerAdapter(ExtensionLoader.getExtensionLoader(LoggerAdapter.class).getExtension(loggerAdapter));
- }
- }
+ /**
+ * 获取日志输出器
+ *
+ * @param key 分类键
+ * @return 日志输出器, 后验条件: 不返回null.
+ */
+ public static Logger getLogger(Class> key) {
+ FailsafeLogger logger = LOGGERS.get(key.getName());
+ if (logger == null) {
+ LOGGERS.putIfAbsent(key.getName(), new FailsafeLogger(LOGGER_ADAPTER.getLogger(key)));
+ logger = LOGGERS.get(key.getName());
+ }
+ return logger;
+ }
- /**
- * 设置日志输出器供给器
- *
- * @param loggerAdapter
- * 日志输出器供给器
- */
- public static void setLoggerAdapter(LoggerAdapter loggerAdapter) {
- if (loggerAdapter != null) {
- Logger logger = loggerAdapter.getLogger(LoggerFactory.class.getName());
- logger.info("using logger: " + loggerAdapter.getClass().getName());
- LoggerFactory.LOGGER_ADAPTER = loggerAdapter;
- for (Map.Entry entry : LOGGERS.entrySet()) {
- entry.getValue().setLogger(LOGGER_ADAPTER.getLogger(entry.getKey()));
- }
- }
- }
+ /**
+ * 获取日志输出器
+ *
+ * @param key 分类键
+ * @return 日志输出器, 后验条件: 不返回null.
+ */
+ public static Logger getLogger(String key) {
+ FailsafeLogger logger = LOGGERS.get(key);
+ if (logger == null) {
+ LOGGERS.putIfAbsent(key, new FailsafeLogger(LOGGER_ADAPTER.getLogger(key)));
+ logger = LOGGERS.get(key);
+ }
+ return logger;
+ }
- /**
- * 获取日志输出器
- *
- * @param key
- * 分类键
- * @return 日志输出器, 后验条件: 不返回null.
- */
- public static Logger getLogger(Class> key) {
- FailsafeLogger logger = LOGGERS.get(key.getName());
- if (logger == null) {
- LOGGERS.putIfAbsent(key.getName(), new FailsafeLogger(LOGGER_ADAPTER.getLogger(key)));
- logger = LOGGERS.get(key.getName());
- }
- return logger;
- }
+ /**
+ * 动态设置输出日志级别
+ *
+ * @param level 日志级别
+ */
+ public static void setLevel(Level level) {
+ LOGGER_ADAPTER.setLevel(level);
+ }
- /**
- * 获取日志输出器
- *
- * @param key
- * 分类键
- * @return 日志输出器, 后验条件: 不返回null.
- */
- public static Logger getLogger(String key) {
- FailsafeLogger logger = LOGGERS.get(key);
- if (logger == null) {
- LOGGERS.putIfAbsent(key, new FailsafeLogger(LOGGER_ADAPTER.getLogger(key)));
- logger = LOGGERS.get(key);
- }
- return logger;
- }
-
- /**
- * 动态设置输出日志级别
- *
- * @param level 日志级别
- */
- public static void setLevel(Level level) {
- LOGGER_ADAPTER.setLevel(level);
- }
+ /**
+ * 获取日志级别
+ *
+ * @return 日志级别
+ */
+ public static Level getLevel() {
+ return LOGGER_ADAPTER.getLevel();
+ }
- /**
- * 获取日志级别
- *
- * @return 日志级别
- */
- public static Level getLevel() {
- return LOGGER_ADAPTER.getLevel();
- }
-
- /**
- * 获取日志文件
- *
- * @return 日志文件
- */
- public static File getFile() {
- return LOGGER_ADAPTER.getFile();
- }
+ /**
+ * 获取日志文件
+ *
+ * @return 日志文件
+ */
+ public static File getFile() {
+ return LOGGER_ADAPTER.getFile();
+ }
}
\ No newline at end of file
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/log4j2/Log4j2Logger.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/log4j2/Log4j2Logger.java
new file mode 100644
index 00000000000..636e4f684ef
--- /dev/null
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/log4j2/Log4j2Logger.java
@@ -0,0 +1,100 @@
+
+package com.alibaba.dubbo.common.logger.log4j2;
+
+import com.alibaba.dubbo.common.logger.Logger;
+
+/**
+ * author: yangjunming (http://yjmyzz.cnblogs.com/)
+ * since: 2016-02-24
+ */
+public class Log4j2Logger implements Logger {
+
+ //private static final String FQCN = FailsafeLogger.class.getName();
+
+ private final org.slf4j.Logger logger;
+
+ public Log4j2Logger(org.slf4j.Logger logger) {
+ this.logger = logger;
+ }
+
+ public void trace(String msg) {
+ logger.trace(msg);
+ }
+
+ public void trace(Throwable e) {
+ logger.trace(e == null ? null : e.getMessage());
+ }
+
+ public void trace(String msg, Throwable e) {
+ logger.trace(msg, e);
+ }
+
+ public void debug(String msg) {
+ logger.debug(msg);
+ }
+
+ public void debug(Throwable e) {
+ logger.debug(e == null ? null : e.getMessage());
+ }
+
+ public void debug(String msg, Throwable e) {
+ logger.debug(msg, e);
+ }
+
+ public void info(String msg) {
+ logger.info(msg);
+ }
+
+ public void info(Throwable e) {
+ logger.info(e == null ? null : e.getMessage());
+ }
+
+ public void info(String msg, Throwable e) {
+ logger.info(msg, e);
+ }
+
+ public void warn(String msg) {
+ logger.warn(msg);
+ }
+
+ public void warn(Throwable e) {
+ logger.warn(e == null ? null : e.getMessage());
+ }
+
+ public void warn(String msg, Throwable e) {
+ logger.warn(msg, e);
+ }
+
+ public void error(String msg) {
+ logger.error(msg);
+ }
+
+ public void error(Throwable e) {
+ logger.error(e == null ? null : e.getMessage());
+ }
+
+ public void error(String msg, Throwable e) {
+ logger.error(msg, e);
+ }
+
+ public boolean isTraceEnabled() {
+ return logger.isTraceEnabled();
+ }
+
+ public boolean isDebugEnabled() {
+ return logger.isDebugEnabled();
+ }
+
+ public boolean isInfoEnabled() {
+ return logger.isInfoEnabled();
+ }
+
+ public boolean isWarnEnabled() {
+ return logger.isWarnEnabled();
+ }
+
+ public boolean isErrorEnabled() {
+ return logger.isErrorEnabled();
+ }
+
+}
\ No newline at end of file
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/log4j2/Log4j2LoggerAdapter.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/log4j2/Log4j2LoggerAdapter.java
new file mode 100644
index 00000000000..2d1a014d1c1
--- /dev/null
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/logger/log4j2/Log4j2LoggerAdapter.java
@@ -0,0 +1,105 @@
+package com.alibaba.dubbo.common.logger.log4j2;
+
+import com.alibaba.dubbo.common.logger.Level;
+import com.alibaba.dubbo.common.logger.Logger;
+import com.alibaba.dubbo.common.logger.LoggerAdapter;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.core.Appender;
+import org.apache.logging.log4j.core.LoggerContext;
+import org.apache.logging.log4j.core.appender.FileAppender;
+import org.apache.logging.log4j.core.config.Configuration;
+import org.apache.logging.log4j.core.config.LoggerConfig;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Map;
+
+public class Log4j2LoggerAdapter implements LoggerAdapter {
+
+ @SuppressWarnings("unchecked")
+ public Log4j2LoggerAdapter() {
+ try {
+ org.apache.logging.log4j.Logger logger = LogManager.getLogger();
+ if (logger != null) {
+ Map appenderMap =
+ ((org.apache.logging.log4j.core.Logger) logger).getAppenders();
+ for (Map.Entry entry : appenderMap.entrySet()) {
+ if (entry.getValue() instanceof FileAppender) {
+ String filename = ((FileAppender) entry.getValue()).getFileName();
+ file = new File(filename);
+ break;
+ }
+ }
+ }
+ } catch (Throwable t) {
+ }
+ }
+
+ public Logger getLogger(String key) {
+ return new Log4j2Logger(LoggerFactory.getLogger(key));
+ }
+
+ public Logger getLogger(Class> key) {
+ return new Log4j2Logger(LoggerFactory.getLogger(key));
+ }
+
+ private File file;
+
+ public void setLevel(Level level) {
+ LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+ Configuration config = ctx.getConfiguration();
+ LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
+ loggerConfig.setLevel(toLog4jLevel(level));
+ ctx.updateLoggers();
+ }
+
+ public Level getLevel() {
+ LoggerContext ctx = (LoggerContext) LogManager.getContext(false);
+ Configuration config = ctx.getConfiguration();
+ LoggerConfig loggerConfig = config.getLoggerConfig(LogManager.ROOT_LOGGER_NAME);
+ return fromLog4jLevel(loggerConfig.getLevel());
+ }
+
+
+ public File getFile() {
+ return file;
+ }
+
+ public void setFile(File file) {
+ this.file = file;
+ }
+
+
+ public static org.apache.logging.log4j.Level toLog4jLevel(Level level) {
+ if (level == Level.ALL)
+ return org.apache.logging.log4j.Level.ALL;
+ if (level == Level.TRACE)
+ return org.apache.logging.log4j.Level.TRACE;
+ if (level == Level.DEBUG)
+ return org.apache.logging.log4j.Level.DEBUG;
+ if (level == Level.INFO)
+ return org.apache.logging.log4j.Level.INFO;
+ if (level == Level.WARN)
+ return org.apache.logging.log4j.Level.WARN;
+ if (level == Level.ERROR)
+ return org.apache.logging.log4j.Level.ERROR;
+ return org.apache.logging.log4j.Level.OFF;
+ }
+
+ public static Level fromLog4jLevel(org.apache.logging.log4j.Level level) {
+ if (level == org.apache.logging.log4j.Level.ALL)
+ return Level.ALL;
+ if (level == org.apache.logging.log4j.Level.TRACE)
+ return Level.TRACE;
+ if (level == org.apache.logging.log4j.Level.DEBUG)
+ return Level.DEBUG;
+ if (level == org.apache.logging.log4j.Level.INFO)
+ return Level.INFO;
+ if (level == org.apache.logging.log4j.Level.WARN)
+ return Level.WARN;
+ if (level == org.apache.logging.log4j.Level.ERROR)
+ return Level.ERROR;
+ return Level.OFF;
+ }
+
+}
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstFactory.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstFactory.java
index 38b531eadb3..c48ed27d92d 100644
--- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstFactory.java
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstFactory.java
@@ -16,9 +16,9 @@
package com.alibaba.dubbo.common.serialize.support.fst;
import com.alibaba.dubbo.common.serialize.support.SerializableClassRegistry;
-import de.ruedigermoeller.serialization.FSTConfiguration;
-import de.ruedigermoeller.serialization.FSTObjectInput;
-import de.ruedigermoeller.serialization.FSTObjectOutput;
+import org.nustaq.serialization.FSTConfiguration;
+import org.nustaq.serialization.FSTObjectInput;
+import org.nustaq.serialization.FSTObjectOutput;
import java.io.InputStream;
import java.io.OutputStream;
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectInput.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectInput.java
index 01fd6ea8dee..fbbcecce612 100644
--- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectInput.java
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectInput.java
@@ -16,8 +16,7 @@
package com.alibaba.dubbo.common.serialize.support.fst;
import com.alibaba.dubbo.common.serialize.ObjectInput;
-import de.ruedigermoeller.serialization.FSTObjectInput;
-
+import org.nustaq.serialization.FSTObjectInput;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectOutput.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectOutput.java
index ba14f041bbd..fadb903135a 100644
--- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectOutput.java
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/serialize/support/fst/FstObjectOutput.java
@@ -16,11 +16,13 @@
package com.alibaba.dubbo.common.serialize.support.fst;
import com.alibaba.dubbo.common.serialize.ObjectOutput;
-import de.ruedigermoeller.serialization.FSTObjectOutput;
+import org.nustaq.serialization.FSTObjectOutput;
import java.io.IOException;
import java.io.OutputStream;
+//import de.ruedigermoeller.serialization.FSTObjectOutput;
+
/**
* @author lishen
*/
diff --git a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/NetUtils.java b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/NetUtils.java
index a037544e5ab..cb45dc022c1 100644
--- a/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/NetUtils.java
+++ b/dubbo-common/src/main/java/com/alibaba/dubbo/common/utils/NetUtils.java
@@ -15,21 +15,17 @@
*/
package com.alibaba.dubbo.common.utils;
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.common.logger.Logger;
+import com.alibaba.dubbo.common.logger.LoggerFactory;
+
import java.io.IOException;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.NetworkInterface;
-import java.net.ServerSocket;
-import java.net.UnknownHostException;
+import java.net.*;
import java.util.Enumeration;
import java.util.Map;
import java.util.Random;
import java.util.regex.Pattern;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.common.logger.Logger;
-import com.alibaba.dubbo.common.logger.LoggerFactory;
-
/**
* IP and Port Helper for RPC,
*
@@ -133,6 +129,19 @@ public static boolean isValidLocalHost(String host) {
return ! isInvalidLocalHost(host);
}
+
+ public static boolean isMulticastAddress(String ip) {
+ int i = ip.indexOf('.');
+ if (i > 0) {
+ String prefix = ip.substring(0, i);
+ if (StringUtils.isInteger(prefix)) {
+ int p = Integer.parseInt(prefix);
+ return p >= 224 && p <= 239;
+ }
+ }
+ return false;
+ }
+
public static InetSocketAddress getLocalSocketAddress(String host, int port) {
return isInvalidLocalHost(host) ?
new InetSocketAddress(port) : new InetSocketAddress(host, port);
diff --git a/dubbo-config/dubbo-config-api/pom.xml b/dubbo-config/dubbo-config-api/pom.xml
index d1f6a82c9c8..9ee78f72559 100644
--- a/dubbo-config/dubbo-config-api/pom.xml
+++ b/dubbo-config/dubbo-config-api/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-config
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-config-api
jar
@@ -72,12 +72,12 @@
${project.parent.version}
test
-
- com.alibaba
- dubbo-rpc-rmi
- ${project.parent.version}
- test
-
+
+
+
+
+
+
com.alibaba
dubbo-rpc-injvm
diff --git a/dubbo-config/dubbo-config-spring/pom.xml b/dubbo-config/dubbo-config-spring/pom.xml
index 9732dff29d6..44c5d6f05ee 100644
--- a/dubbo-config/dubbo-config-spring/pom.xml
+++ b/dubbo-config/dubbo-config-spring/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-config
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-config-spring
jar
@@ -60,12 +60,12 @@
${project.parent.version}
test
-
- com.alibaba
- dubbo-rpc-rmi
- ${project.parent.version}
- test
-
+
+
+
+
+
+
com.alibaba
dubbo-rpc-injvm
diff --git a/dubbo-config/pom.xml b/dubbo-config/pom.xml
index 925195632b1..3cc99c10435 100644
--- a/dubbo-config/pom.xml
+++ b/dubbo-config/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-parent
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-config
pom
diff --git a/dubbo-container/dubbo-container-api/pom.xml b/dubbo-container/dubbo-container-api/pom.xml
index 3cb4bda94c4..7ae694e8ad7 100644
--- a/dubbo-container/dubbo-container-api/pom.xml
+++ b/dubbo-container/dubbo-container-api/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-container
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-container-api
jar
diff --git a/dubbo-container/dubbo-container-javaconfig/pom.xml b/dubbo-container/dubbo-container-javaconfig/pom.xml
index 3cc3985b60e..9ae9c5c804e 100644
--- a/dubbo-container/dubbo-container-javaconfig/pom.xml
+++ b/dubbo-container/dubbo-container-javaconfig/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-container
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-container-javaconfig
jar
diff --git a/dubbo-container/dubbo-container-jetty/pom.xml b/dubbo-container/dubbo-container-jetty/pom.xml
index 3fd180fb91a..570d00d2644 100644
--- a/dubbo-container/dubbo-container-jetty/pom.xml
+++ b/dubbo-container/dubbo-container-jetty/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-container
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-container-jetty
jar
diff --git a/dubbo-container/dubbo-container-log4j/pom.xml b/dubbo-container/dubbo-container-log4j/pom.xml
index be4637f3263..942f25c9ff9 100644
--- a/dubbo-container/dubbo-container-log4j/pom.xml
+++ b/dubbo-container/dubbo-container-log4j/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-container
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-container-log4j
jar
diff --git a/dubbo-container/dubbo-container-logback/pom.xml b/dubbo-container/dubbo-container-logback/pom.xml
index a123294937e..f5e7ca2bbcb 100644
--- a/dubbo-container/dubbo-container-logback/pom.xml
+++ b/dubbo-container/dubbo-container-logback/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-container
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-container-logback
jar
diff --git a/dubbo-container/dubbo-container-spring/pom.xml b/dubbo-container/dubbo-container-spring/pom.xml
index 9564561a899..6ede6fc1a7b 100644
--- a/dubbo-container/dubbo-container-spring/pom.xml
+++ b/dubbo-container/dubbo-container-spring/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-container
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-container-spring
jar
diff --git a/dubbo-container/pom.xml b/dubbo-container/pom.xml
index b277ac00762..0d30fe7b21e 100644
--- a/dubbo-container/pom.xml
+++ b/dubbo-container/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-parent
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-container
pom
diff --git a/dubbo-demo/dubbo-demo-api/pom.xml b/dubbo-demo/dubbo-demo-api/pom.xml
index a311efe313b..f22c3f5969b 100644
--- a/dubbo-demo/dubbo-demo-api/pom.xml
+++ b/dubbo-demo/dubbo-demo-api/pom.xml
@@ -19,42 +19,83 @@
com.alibaba
dubbo-demo
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-demo-api
jar
${project.artifactId}
The demo module of dubbo project
-
- true
-
-
-
- com.alibaba
- dubbo
- ${project.parent.version}
-
-
- javax.servlet
- javax.servlet-api
-
-
- javax.validation
- validation-api
-
-
- javax.ws.rs
- javax.ws.rs-api
-
-
- javax.annotation
- javax.annotation-api
- 1.2
-
-
- org.codehaus.jackson
- jackson-mapper-asl
- 1.9.12
-
-
+
+
+
+
+ kr.motd.maven
+ os-maven-plugin
+ 1.4.1.Final
+
+
+
+
+ org.xolstice.maven.plugins
+ protobuf-maven-plugin
+ 0.5.0
+
+ com.google.protobuf:protoc:3.0.0:exe:${os.detected.classifier}
+ grpc-java
+ io.grpc:protoc-gen-grpc-java:1.0.1:exe:${os.detected.classifier}
+
+
+
+
+ compile
+ compile-custom
+
+
+
+
+
+
+ org.apache.thrift.tools
+ maven-thrift-plugin
+ 0.1.11
+
+ /usr/local/bin/thrift
+
+
+
+ thrift-sources
+ generate-sources
+
+ compile
+
+
+
+ thrift-test-sources
+ generate-test-sources
+
+ testCompile
+
+
+
+
+
+
+ org.apache.avro
+ avro-maven-plugin
+ 1.8.1
+
+
+ schemas
+ generate-sources
+
+ schema
+ protocol
+ idl-protocol
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-api/src/main/avro/hello.avdl b/dubbo-demo/dubbo-demo-api/src/main/avro/hello.avdl
new file mode 100644
index 00000000000..bf433cf77af
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-api/src/main/avro/hello.avdl
@@ -0,0 +1,5 @@
+@namespace ("com.cnblogs.yjmyzz.demo.service.api.avro")
+protocol AvroHelloService
+{
+ string ping();
+}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/SerializationOptimizerImpl.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/SerializationOptimizerImpl.java
deleted file mode 100644
index 881ba9b49b4..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/SerializationOptimizerImpl.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo;
-
-import com.alibaba.dubbo.common.serialize.support.SerializationOptimizer;
-import com.alibaba.dubbo.demo.bid.BidRequest;
-import com.alibaba.dubbo.demo.bid.BidResponse;
-import com.alibaba.dubbo.demo.bid.Device;
-import com.alibaba.dubbo.demo.bid.Geo;
-import com.alibaba.dubbo.demo.bid.Impression;
-import com.alibaba.dubbo.demo.bid.SeatBid;
-import com.alibaba.dubbo.demo.user.User;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * This class must be accessible from both the provider and consumer
- *
- * @author lishen
- */
-public class SerializationOptimizerImpl implements SerializationOptimizer {
-
- public Collection getSerializableClasses() {
- List classes = new LinkedList();
- classes.add(BidRequest.class);
- classes.add(BidResponse.class);
- classes.add(Device.class);
- classes.add(Geo.class);
- classes.add(Impression.class);
- classes.add(SeatBid.class);
- classes.add(User.class);
- return classes;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidRequest.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidRequest.java
deleted file mode 100644
index 905be3e4cf8..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidRequest.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.bid;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author lishen
- */
-public class BidRequest implements Serializable {
-
- private String id;
-
- private Device device;
-
- private List impressions;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Device getDevice() {
- return device;
- }
-
- public void setDevice(Device device) {
- this.device = device;
- }
-
- public List getImpressions() {
- return impressions;
- }
-
- public void setImpressions(List impressions) {
- this.impressions = impressions;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidResponse.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidResponse.java
deleted file mode 100644
index e5b26b425de..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidResponse.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.bid;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @author lishen
- */
-public class BidResponse implements Serializable {
-
- private String id;
- private List seatBids;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public List getSeatBids() {
- return seatBids;
- }
-
- public void setSeatBids(List seatBids) {
- this.seatBids = seatBids;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidService.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidService.java
deleted file mode 100644
index 31ed65d0ad4..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/BidService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.bid;
-
-public interface BidService {
-
- BidResponse bid(BidRequest request);
-
- void throwNPE() throws NullPointerException;
-}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/Device.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/Device.java
deleted file mode 100644
index 81dcab6960f..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/Device.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.bid;
-
-import java.io.Serializable;
-
-/**
- * @author lishen
- */
-public class Device implements Serializable {
-
- private String os;
- private String make;
- private String version;
- private String model;
- private String lang;
- private Geo geo;
-
- public String getOs() {
- return os;
- }
-
- public void setOs(String os) {
- this.os = os;
- }
-
- public String getMake() {
- return make;
- }
-
- public void setMake(String make) {
- this.make = make;
- }
-
- public String getVersion() {
- return version;
- }
-
- public void setVersion(String version) {
- this.version = version;
- }
-
- public String getModel() {
- return model;
- }
-
- public void setModel(String model) {
- this.model = model;
- }
-
- public String getLang() {
- return lang;
- }
-
- public void setLang(String lang) {
- this.lang = lang;
- }
-
- public Geo getGeo() {
- return geo;
- }
-
- public void setGeo(Geo geo) {
- this.geo = geo;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/Geo.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/Geo.java
deleted file mode 100644
index ddbe6b2e547..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/bid/Geo.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.bid;
-
-import java.io.Serializable;
-
-/**
- * @author lishen
- */
-public class Geo implements Serializable {
-
- private float lon;
- private float lat;
- private String country;
- private String city;
-
- public float getLon() {
- return lon;
- }
-
- public void setLon(float lon) {
- this.lon = lon;
- }
-
- public float getLat() {
- return lat;
- }
-
- public void setLat(float lat) {
- this.lat = lat;
- }
-
- public String getCountry() {
- return country;
- }
-
- public void setCountry(String country) {
- this.country = country;
- }
-
- public String getCity() {
- return city;
- }
-
- public void setCity(String city) {
- this.city = city;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/ClientTraceFilter.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/ClientTraceFilter.java
deleted file mode 100644
index 8796e71b880..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/ClientTraceFilter.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.extension;
-
-import javax.ws.rs.client.ClientRequestContext;
-import javax.ws.rs.client.ClientRequestFilter;
-import javax.ws.rs.client.ClientResponseContext;
-import javax.ws.rs.client.ClientResponseFilter;
-import java.io.IOException;
-
-/**
- * @author lishen
- */
-public class ClientTraceFilter implements ClientRequestFilter, ClientResponseFilter {
-
- public void filter(ClientRequestContext requestContext) throws IOException {
- System.out.println("Client request filter invoked");
- }
-
- public void filter(ClientRequestContext clientRequestContext, ClientResponseContext clientResponseContext) throws IOException {
- System.out.println("Client response filter invoked");
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/CustomExceptionMapper.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/CustomExceptionMapper.java
deleted file mode 100644
index 82397901ab9..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/CustomExceptionMapper.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.extension;
-
-import com.alibaba.dubbo.rpc.RpcContext;
-
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.core.Response;
-import javax.ws.rs.ext.ExceptionMapper;
-
-/**
- * @author lishen
- */
-public class CustomExceptionMapper implements ExceptionMapper {
-
- public Response toResponse(NotFoundException e) {
- System.out.println("Exception mapper successfully got an exception: " + e + ":" + e.getMessage());
- System.out.println("Client IP is " + RpcContext.getContext().getRemoteAddressString());
- return Response.status(Response.Status.NOT_FOUND).entity("Oops! the requested resource is not found!").type("text/plain").build();
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/DynamicTraceBinding.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/DynamicTraceBinding.java
deleted file mode 100644
index 27e6521bd80..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/DynamicTraceBinding.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.extension;
-
-import javax.ws.rs.container.DynamicFeature;
-import javax.ws.rs.container.ResourceInfo;
-import javax.ws.rs.core.FeatureContext;
-
-/**
- * @author lishen
- */
-public class DynamicTraceBinding implements DynamicFeature {
-
- public void configure(ResourceInfo resourceInfo, FeatureContext context) {
- context.register(DynamicTraceInterceptor.class);
- }
-}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/DynamicTraceInterceptor.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/DynamicTraceInterceptor.java
deleted file mode 100644
index f8b8203e01c..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/DynamicTraceInterceptor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.extension;
-
-import javax.annotation.Priority;
-import javax.ws.rs.Priorities;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.ext.ReaderInterceptor;
-import javax.ws.rs.ext.ReaderInterceptorContext;
-import javax.ws.rs.ext.WriterInterceptor;
-import javax.ws.rs.ext.WriterInterceptorContext;
-import java.io.IOException;
-
-/**
- * @author lishen
- */
-@Priority(Priorities.USER)
-public class DynamicTraceInterceptor implements ReaderInterceptor, WriterInterceptor {
-
- public Object aroundReadFrom(ReaderInterceptorContext readerInterceptorContext) throws IOException, WebApplicationException {
- System.out.println("Dynamic reader interceptor invoked");
- return readerInterceptorContext.proceed();
- }
-
- public void aroundWriteTo(WriterInterceptorContext writerInterceptorContext) throws IOException, WebApplicationException {
- System.out.println("Dynamic writer interceptor invoked");
- writerInterceptorContext.proceed();
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/TraceFilter.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/TraceFilter.java
deleted file mode 100644
index 91277002837..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/TraceFilter.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.extension;
-
-import javax.annotation.Priority;
-import javax.ws.rs.Priorities;
-import javax.ws.rs.container.ContainerRequestContext;
-import javax.ws.rs.container.ContainerRequestFilter;
-import javax.ws.rs.container.ContainerResponseContext;
-import javax.ws.rs.container.ContainerResponseFilter;
-import java.io.IOException;
-
-/**
- * @author lishen
- */
-@Priority(Priorities.USER)
-public class TraceFilter implements ContainerRequestFilter, ContainerResponseFilter {
-
- public void filter(ContainerRequestContext requestContext) throws IOException {
- System.out.println("Request filter invoked");
- }
-
- public void filter(ContainerRequestContext containerRequestContext, ContainerResponseContext containerResponseContext) throws IOException {
- System.out.println("Response filter invoked");
- }
-}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/TraceInterceptor.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/TraceInterceptor.java
deleted file mode 100644
index f8c25fc585b..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/extension/TraceInterceptor.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.extension;
-
-import javax.annotation.Priority;
-import javax.ws.rs.Priorities;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.ext.ReaderInterceptor;
-import javax.ws.rs.ext.ReaderInterceptorContext;
-import javax.ws.rs.ext.WriterInterceptor;
-import javax.ws.rs.ext.WriterInterceptorContext;
-import java.io.IOException;
-
-/**
- * @author lishen
- */
-@Priority(Priorities.USER)
-public class TraceInterceptor implements ReaderInterceptor, WriterInterceptor {
-
- public Object aroundReadFrom(ReaderInterceptorContext readerInterceptorContext) throws IOException, WebApplicationException {
- System.out.println("Reader interceptor invoked");
- return readerInterceptorContext.proceed();
- }
-
- public void aroundWriteTo(WriterInterceptorContext writerInterceptorContext) throws IOException, WebApplicationException {
- System.out.println("Writer interceptor invoked");
- writerInterceptorContext.proceed();
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/hello/HelloService.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/hello/HelloService.java
deleted file mode 100644
index 297e7915e21..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/hello/HelloService.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.hello;
-
-/**
- * @author lishen
- */
-public interface HelloService {
- String hello(String name);
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/User.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/User.java
deleted file mode 100644
index eb5a3b86f3c..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/User.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user;
-
-import org.codehaus.jackson.annotate.JsonProperty;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * @author lishen
- */
-@XmlRootElement
-@XmlAccessorType(XmlAccessType.FIELD)
-public class User implements Serializable {
-
- @NotNull
- @Min(1L)
- private Long id;
-
- @JsonProperty("username")
- @XmlElement(name = "username")
- @NotNull
- @Size(min = 6, max = 50)
- private String name;
-
- public User() {
- }
-
- public User(Long id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- @Override
- public String toString() {
- return "User (" +
- "id=" + id +
- ", name='" + name + '\'' +
- ')';
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/UserService.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/UserService.java
deleted file mode 100644
index 74782f25c6e..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/UserService.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user;
-
-/**
- * @author lishen
- */
-public interface UserService {
- User getUser(Long id);
-
- Long registerUser(User user);
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/AnotherUserRestService.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/AnotherUserRestService.java
deleted file mode 100644
index 91ab166133e..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/AnotherUserRestService.java
+++ /dev/null
@@ -1,30 +0,0 @@
-package com.alibaba.dubbo.demo.user.facade;
-
-import com.alibaba.dubbo.demo.user.User;
-import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
-
-import javax.validation.constraints.Min;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-/**
- * @author lishen
- */
-@Path("u")
-@Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
-@Produces({ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
-public interface AnotherUserRestService {
-
- @GET
- @Path("{id : \\d+}")
- User getUser(@PathParam("id") @Min(1L) Long id);
-
- @POST
- @Path("register")
- RegistrationResult registerUser(User user);
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/RegistrationResult.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/RegistrationResult.java
deleted file mode 100644
index 1924ed0c805..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/RegistrationResult.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user.facade;
-
-import javax.xml.bind.annotation.XmlRootElement;
-import java.io.Serializable;
-
-/**
- * DTO to customize the returned message
- *
- * @author lishen
- */
-@XmlRootElement
-public class RegistrationResult implements Serializable {
-
- private Long id;
-
- public RegistrationResult() {
- }
-
- public RegistrationResult(Long id) {
- this.id = id;
- }
-
- public Long getId() {
- return id;
- }
-
- public void setId(Long id) {
- this.id = id;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/UserRestService.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/UserRestService.java
deleted file mode 100644
index 87f28fcd982..00000000000
--- a/dubbo-demo/dubbo-demo-api/src/main/java/com/alibaba/dubbo/demo/user/facade/UserRestService.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user.facade;
-
-import com.alibaba.dubbo.demo.user.User;
-
-import javax.validation.constraints.Min;
-
-/**
- * This interface acts as some kind of service broker for the original UserService
-
- * Here we want to simulate the twitter/weibo rest api, e.g.
- *
- * http://localhost:8888/user/1.json
- * http://localhost:8888/user/1.xml
- *
- * @author lishen
- */
-public interface UserRestService {
-
- /**
- * the request object is just used to test jax-rs injection.
- */
- User getUser(@Min(value=1L, message="User ID must be greater than 1") Long id/*, HttpServletRequest request*/);
-
- RegistrationResult registerUser(User user);
-}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/dubbo/DubboHelloService.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/dubbo/DubboHelloService.java
new file mode 100644
index 00000000000..6f03196df81
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/dubbo/DubboHelloService.java
@@ -0,0 +1,11 @@
+package com.cnblogs.yjmyzz.demo.service.api.dubbo;
+
+/**
+ * Created by yangjunming on 2016/11/2.
+ */
+public interface DubboHelloService {
+
+ String ping();
+
+ String register(User user);
+}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/dubbo/User.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/dubbo/User.java
new file mode 100644
index 00000000000..f6996a30e5d
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/dubbo/User.java
@@ -0,0 +1,37 @@
+package com.cnblogs.yjmyzz.demo.service.api.dubbo;
+
+import java.io.Serializable;
+
+/**
+ * Created by yangjunming on 2016/11/2.
+ */
+public class User implements Serializable {
+
+ private int userId;
+
+ private String userName;
+
+ public int getUserId() {
+ return userId;
+ }
+
+ public void setUserId(int userId) {
+ this.userId = userId;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ @Override
+ public String toString() {
+ return "User{" +
+ "userId=" + userId +
+ ", userName='" + userName + '\'' +
+ '}';
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/rest/RestHelloService.java b/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/rest/RestHelloService.java
new file mode 100644
index 00000000000..b99991365d6
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-api/src/main/java/com/cnblogs/yjmyzz/demo/service/api/rest/RestHelloService.java
@@ -0,0 +1,24 @@
+package com.cnblogs.yjmyzz.demo.service.api.rest;
+
+import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
+import com.cnblogs.yjmyzz.demo.service.api.dubbo.User;
+
+import javax.ws.rs.*;
+import javax.ws.rs.core.MediaType;
+
+/**
+ * Created by yangjunming on 2016/11/2.
+ */
+@Path("demo")
+@Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
+@Produces({ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
+public interface RestHelloService {
+
+ @GET
+ @Path("/ping")
+ String ping();
+
+ @POST
+ @Path("/reg")
+ String register(User user);
+}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/proto/hello.proto b/dubbo-demo/dubbo-demo-api/src/main/proto/hello.proto
new file mode 100644
index 00000000000..061ff48b34d
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-api/src/main/proto/hello.proto
@@ -0,0 +1,17 @@
+syntax = "proto3";
+
+option java_multiple_files = true;
+option java_package = "com.cnblogs.yjmyzz.demo.service.api.grpc";
+option java_outer_classname = "GrpcHelloServiceProto";
+
+package hello;
+
+service GrpcHelloService {
+ rpc ping (PingRequest) returns (PingResponse) {}
+}
+
+message PingRequest{}
+
+message PingResponse {
+ string message = 1;
+}
diff --git a/dubbo-demo/dubbo-demo-api/src/main/thrift/hello.thrift b/dubbo-demo/dubbo-demo-api/src/main/thrift/hello.thrift
new file mode 100644
index 00000000000..57b66b20735
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-api/src/main/thrift/hello.thrift
@@ -0,0 +1,5 @@
+namespace java com.cnblogs.yjmyzz.demo.service.api.thrift
+
+service ThriftHelloService{
+ string ping()
+}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/pom.xml b/dubbo-demo/dubbo-demo-consumer/pom.xml
index 3e2427967bb..3ad4a1c899e 100644
--- a/dubbo-demo/dubbo-demo-consumer/pom.xml
+++ b/dubbo-demo/dubbo-demo-consumer/pom.xml
@@ -1,25 +1,10 @@
-
4.0.0
com.alibaba
dubbo-demo
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-demo-consumer
jar
@@ -34,200 +19,7 @@
dubbo-demo-api
${project.parent.version}
-
- com.alibaba
- dubbo
- ${project.parent.version}
-
-
- org.javassist
- javassist
-
-
- io.netty
- netty
-
-
- org.apache.mina
- mina-core
-
-
- org.glassfish.grizzly
- grizzly-core
-
-
- org.apache.httpcomponents
- httpclient
-
-
- com.alibaba
- fastjson
-
-
- com.thoughtworks.xstream
- xstream
-
-
- org.apache.bsf
- bsf-api
-
-
- org.apache.zookeeper
- zookeeper
-
-
- com.github.sgroschupf
- zkclient
-
-
- org.apache.curator
- curator-framework
-
-
- com.googlecode.xmemcached
- xmemcached
-
-
- org.apache.cxf
- cxf-rt-frontend-simple
-
-
- org.apache.cxf
- cxf-rt-transports-http
-
-
- org.apache.thrift
- libthrift
-
-
- com.caucho
- hessian
-
-
- javax.servlet
- javax.servlet-api
-
-
- org.mortbay.jetty
- jetty
-
-
- log4j
- log4j
-
-
- org.slf4j
- slf4j-api
-
-
- redis.clients
- jedis
-
-
- javax.validation
- validation-api
-
-
- org.hibernate
- hibernate-validator
-
-
- javax.cache
- cache-api
-
-
- org.jboss.resteasy
- resteasy-jaxrs
-
-
-
- org.jboss.resteasy
- resteasy-client
-
-
-
- org.jboss.resteasy
- resteasy-netty
-
-
-
- org.jboss.resteasy
- resteasy-jdk-http
-
-
-
- org.jboss.resteasy
- resteasy-jackson-provider
-
-
-
- org.jboss.resteasy
- resteasy-jaxb-provider
-
-
-
- org.apache.tomcat.embed
- tomcat-embed-core
-
-
- org.apache.tomcat.embed
- tomcat-embed-logging-juli
-
-
-
- com.esotericsoftware.kryo
- kryo
-
-
- de.javakaffee
- kryo-serializers
-
-
- de.ruedigermoeller
- fst
-
-
-
-
- maven-dependency-plugin
-
-
- unpack
- package
-
- unpack
-
-
-
-
- com.alibaba
- dubbo
- ${project.parent.version}
- ${project.build.directory}/dubbo
- META-INF/assembly/**
-
-
-
-
-
-
-
- maven-assembly-plugin
-
- src/main/assembly/assembly.xml
-
-
-
- make-assembly
- package
-
- single
-
-
-
-
-
-
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/assembly/assembly.xml b/dubbo-demo/dubbo-demo-consumer/src/main/assembly/assembly.xml
deleted file mode 100644
index 25235d9064e..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/assembly/assembly.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
- assembly
-
- tar.gz
-
- true
-
-
- ${project.build.directory}/dubbo/META-INF/assembly/bin
- bin
- 0755
-
-
- src/main/assembly/conf
- conf
- 0644
-
-
-
-
- lib
-
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/assembly/conf/dubbo.properties b/dubbo-demo/dubbo-demo-consumer/src/main/assembly/conf/dubbo.properties
deleted file mode 100644
index d3cc21f6af0..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/assembly/conf/dubbo.properties
+++ /dev/null
@@ -1,25 +0,0 @@
-##
-# Copyright 1999-2011 Alibaba Group.
-#
-# 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.
-##
-dubbo.container=log4j,spring
-dubbo.application.name=demo-consumer
-dubbo.application.owner=
-dubbo.registry.address=multicast://224.5.6.7:1234
-#dubbo.registry.address=zookeeper://127.0.0.1:2181
-#dubbo.registry.address=redis://127.0.0.1:6379
-#dubbo.registry.address=dubbo://127.0.0.1:9090
-dubbo.monitor.protocol=registry
-dubbo.log4j.file=logs/dubbo-demo-consumer.log
-dubbo.log4j.level=WARN
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/DemoAction.java b/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/DemoAction.java
deleted file mode 100644
index b6138e729ad..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/DemoAction.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright 1999-2011 Alibaba Group.
- *
- * 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 com.alibaba.dubbo.demo.consumer;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import com.alibaba.dubbo.demo.bid.*;
-import com.alibaba.dubbo.demo.user.User;
-import com.alibaba.dubbo.demo.user.facade.AnotherUserRestService;
-import com.alibaba.dubbo.rpc.RpcContext;
-
-public class DemoAction {
-
- private BidService bidService;
-
- private AnotherUserRestService anotherUserRestService;
-
- public void setBidService(BidService bidService) {
- this.bidService = bidService;
- }
-
- public void setAnotherUserRestService(AnotherUserRestService anotherUserRestService) {
- this.anotherUserRestService = anotherUserRestService;
- }
-
- public void start() throws Exception {
- BidRequest request = new BidRequest();
-
- Impression imp = new Impression();
- imp.setBidFloor(1.1);
- imp.setId("abc");
- List imps = new ArrayList(1);
- imps.add(imp);
- request.setImpressions(imps);
-
- Geo geo = new Geo();
- geo.setCity("beijing");
- geo.setCountry("china");
- geo.setLat(100.1f);
- geo.setLon(100.1f);
-
- Device device = new Device();
- device.setMake("apple");
- device.setOs("ios");
- device.setVersion("7.0");
- device.setLang("zh_CN");
- device.setModel("iphone");
- device.setGeo(geo);
- request.setDevice(device);
-
-// long start = System.currentTimeMillis();
-
-// for (int i = 0; i < 10000; i ++) {
-// System.out.println(bidService.bid(request).getId());
- System.out.println("SUCCESS: got bid response id: " + bidService.bid(request).getId());
-// }
-
-// System.out.println(">>>>> Total time consumed:" + (System.currentTimeMillis() - start));
-
- try {
- bidService.throwNPE();
- System.out.println("ERROR: no exception found");
- } catch (NullPointerException e) {
- System.out.println("SUCCESS: caught exception " + e.getClass());
- }
-
- User user = new User(1L, "larrypage");
- System.out.println("SUCCESS: registered user with id " + anotherUserRestService.registerUser(user).getId());
-
- RpcContext.getContext().setAttachment("clientName", "demo");
- RpcContext.getContext().setAttachment("clientImpl", "dubbox");
- System.out.println("SUCCESS: got user " + anotherUserRestService.getUser(1L));
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/DemoJavaConfigAction.java b/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/DemoJavaConfigAction.java
deleted file mode 100644
index 636aba17426..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/java/com/alibaba/dubbo/demo/consumer/DemoJavaConfigAction.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
- * Copyright 2006-2014 handu.com.
- *
- * 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 com.alibaba.dubbo.demo.consumer;
-
-import com.alibaba.dubbo.config.annotation.Reference;
-import com.alibaba.dubbo.demo.bid.*;
-import com.alibaba.dubbo.demo.user.User;
-import com.alibaba.dubbo.demo.user.facade.AnotherUserRestService;
-import org.springframework.stereotype.Component;
-
-import javax.annotation.PostConstruct;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @author Jinkai.Ma
- */
-@Component
-public class DemoJavaConfigAction {
-
- @Reference
- private BidService bidService;
-
- @Reference
- private AnotherUserRestService anotherUserRestService;
-
- @PostConstruct
- public void start() throws Exception {
- BidRequest request = new BidRequest();
-
- Impression imp = new Impression();
- imp.setBidFloor(1.1);
- imp.setId("abc");
- List imps = new ArrayList(1);
- imps.add(imp);
- request.setImpressions(imps);
-
- Geo geo = new Geo();
- geo.setCity("beijing");
- geo.setCountry("china");
- geo.setLat(100.1f);
- geo.setLon(100.1f);
-
- Device device = new Device();
- device.setMake("apple");
- device.setOs("ios");
- device.setVersion("7.0");
- device.setLang("zh_CN");
- device.setModel("iphone");
- device.setGeo(geo);
- request.setDevice(device);
-
-// long start = System.currentTimeMillis();
-
-// for (int i = 0; i < 10000; i ++) {
-// System.out.println(bidService.bid(request).getId());
- System.out.println("SUCESS: got bid response id: " + bidService.bid(request).getId());
-// }
-
-// System.out.println(">>>>> Total time consumed:" + (System.currentTimeMillis() - start));
-
- try {
- bidService.throwNPE();
- System.out.println("ERROR: no exception found");
- } catch (NullPointerException e) {
- System.out.println("SUCCESS: caught exception " + e.getClass());
- }
-
- User user = new User(1L, "larrypage");
- System.out.println("SUCESS: registered user with id " + anotherUserRestService.registerUser(user).getId());
-
- System.out.println("SUCESS: got user " + anotherUserRestService.getUser(1L));
- }
-}
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/java/com/cnblogs/yjmyzz/demo/service/consumer/DubboDemoConsumer.java b/dubbo-demo/dubbo-demo-consumer/src/main/java/com/cnblogs/yjmyzz/demo/service/consumer/DubboDemoConsumer.java
new file mode 100644
index 00000000000..ac642b412c8
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-consumer/src/main/java/com/cnblogs/yjmyzz/demo/service/consumer/DubboDemoConsumer.java
@@ -0,0 +1,87 @@
+package com.cnblogs.yjmyzz.demo.service.consumer;
+
+import com.alibaba.dubbo.rpc.protocol.grpc.GrpcBindableService;
+import com.cnblogs.yjmyzz.demo.service.api.avro.AvroHelloService;
+import com.cnblogs.yjmyzz.demo.service.api.dubbo.DubboHelloService;
+import com.cnblogs.yjmyzz.demo.service.api.dubbo.User;
+import com.cnblogs.yjmyzz.demo.service.api.grpc.GrpcHelloServiceGrpc;
+import com.cnblogs.yjmyzz.demo.service.api.grpc.PingRequest;
+import com.cnblogs.yjmyzz.demo.service.api.grpc.PingResponse;
+import com.cnblogs.yjmyzz.demo.service.api.rest.RestHelloService;
+import com.cnblogs.yjmyzz.demo.service.api.thrift.ThriftHelloService;
+import io.grpc.ManagedChannel;
+import io.grpc.stub.AbstractStub;
+import org.apache.avro.AvroRemoteException;
+import org.apache.thrift.TException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Created by yangjunming on 2016/12/25.
+ */
+public class DubboDemoConsumer {
+
+ private static Logger logger = LoggerFactory.getLogger(DubboDemoConsumer.class);
+
+ public static void main(String[] args) throws TException, InterruptedException, AvroRemoteException {
+
+ ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("spring-context.xml");
+
+ testRest(ctx);
+ testDubbo(ctx);
+ testThrift(ctx);
+ testAvro(ctx);
+ testGrpc(ctx);
+ }
+
+ private static void testRest(ConfigurableApplicationContext ctx) {
+ RestHelloService service = ctx.getBean(RestHelloService.class);
+ logger.info("\n---------restful服务测试开始---------");
+ logger.info("\tping=>" + service.ping());
+ logger.info("\tregister=>" + service.register(mockUser()));
+ }
+
+
+ private static void testDubbo(ConfigurableApplicationContext ctx) {
+ DubboHelloService service = ctx.getBean(DubboHelloService.class);
+ logger.info("\n---------dubbo协议测试开始---------");
+ logger.info("\tping=>" + service.ping());
+ logger.info("\tregister=>" + service.register(mockUser()));
+ }
+
+
+ private static void testThrift(ConfigurableApplicationContext ctx) throws TException {
+ ThriftHelloService.Iface service = ctx.getBean(ThriftHelloService.Iface.class);
+ logger.info("\n---------thrift协议测试开始---------");
+ logger.info("\tping=>" + service.ping());
+ }
+
+ private static void testAvro(ConfigurableApplicationContext ctx) throws AvroRemoteException {
+ AvroHelloService service = ctx.getBean(AvroHelloService.class);
+ logger.info("\n---------avro协议测试开始---------");
+ logger.info("\tping=>" + service.ping());
+ }
+
+ private static void testGrpc(ConfigurableApplicationContext ctx) throws InterruptedException {
+ GrpcBindableService service = ctx.getBean(GrpcBindableService.class, "grpcService");
+ AbstractStub stub = GrpcHelloServiceGrpc.newBlockingStub(service.getChannel());
+ PingRequest request = PingRequest.newBuilder().build();
+ logger.info("\n---------gprc协议测试开始---------");
+ logger.info(stub.getClass().toString());
+ PingResponse response = ((GrpcHelloServiceGrpc.GrpcHelloServiceBlockingStub) stub).ping(request);
+ logger.info("\tping=>" + response.getMessage());
+ ((ManagedChannel) stub.getChannel()).shutdown().awaitTermination(5, TimeUnit.SECONDS);
+ }
+
+
+ private static User mockUser() {
+ User u = new User();
+ u.setUserId(1);
+ u.setUserName("菩提树下的杨过");
+ return u;
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/java/dubbo/spring/javaconfig/DubboDemoActionConfig.java b/dubbo-demo/dubbo-demo-consumer/src/main/java/dubbo/spring/javaconfig/DubboDemoActionConfig.java
deleted file mode 100644
index ea27c403923..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/java/dubbo/spring/javaconfig/DubboDemoActionConfig.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * Copyright 2006-2014 handu.com.
- *
- * 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 dubbo.spring.javaconfig;
-
-import com.alibaba.dubbo.demo.consumer.DemoJavaConfigAction;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @author Jinkai.Ma
- */
-@Configuration
-public class DubboDemoActionConfig {
-
- @Bean
- public DemoJavaConfigAction demoAnnotationAction() {
- return new DemoJavaConfigAction();
- }
-
-}
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/java/dubbo/spring/javaconfig/DubboDemoConsumerConfig.java b/dubbo-demo/dubbo-demo-consumer/src/main/java/dubbo/spring/javaconfig/DubboDemoConsumerConfig.java
deleted file mode 100644
index 2052150a92f..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/java/dubbo/spring/javaconfig/DubboDemoConsumerConfig.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- * Copyright 2006-2014 handu.com.
- *
- * 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 dubbo.spring.javaconfig;
-
-import com.alibaba.dubbo.config.ApplicationConfig;
-import com.alibaba.dubbo.config.RegistryConfig;
-import com.alibaba.dubbo.config.spring.AnnotationBean;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @author Jinkai.Ma
- */
-@Configuration
-public class DubboDemoConsumerConfig {
-
- public static final String APPLICATION_NAME = "consumer-of-helloworld-app";
-
- public static final String REGISTRY_ADDRESS = "zookeeper://127.0.0.1:2181";
-
- public static final String ANNOTATION_PACKAGE = "com.alibaba.dubbo.demo.consumer";
-
- @Bean
- public ApplicationConfig applicationConfig() {
- ApplicationConfig applicationConfig = new ApplicationConfig();
- applicationConfig.setName(APPLICATION_NAME);
- return applicationConfig;
- }
-
- @Bean
- public RegistryConfig registryConfig() {
- RegistryConfig registryConfig = new RegistryConfig();
- registryConfig.setAddress(REGISTRY_ADDRESS);
- return registryConfig;
- }
-
- @Bean
- public AnnotationBean annotationBean() {
- AnnotationBean annotationBean = new AnnotationBean();
- annotationBean.setPackage(ANNOTATION_PACKAGE);
- return annotationBean;
- }
-}
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/resouces/dubbo/com.alibaba.dubbo.rpc.Protocol b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/dubbo/com.alibaba.dubbo.rpc.Protocol
new file mode 100644
index 00000000000..ea30049702a
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/dubbo/com.alibaba.dubbo.rpc.Protocol
@@ -0,0 +1,3 @@
+grpc=com.alibaba.dubbo.rpc.protocol.grpc.GrpcProtocol
+thrift2=com.alibaba.dubbo.rpc.protocol.thrift2.Thrift2Protocol
+avro=com.alibaba.dubbo.rpc.protocol.avro.AvroProtocol
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/resouces/log4j2.xml b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/log4j2.xml
new file mode 100644
index 00000000000..ccf6466706c
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/log4j2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/resouces/spring-context.xml b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/spring-context.xml
new file mode 100644
index 00000000000..0565da72053
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/spring-context.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/resouces/spring-dubbo-consumer.xml b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/spring-dubbo-consumer.xml
new file mode 100644
index 00000000000..4f4a57aa973
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-consumer/src/main/resouces/spring-dubbo-consumer.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-action.xml b/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-action.xml
deleted file mode 100644
index fb7662ca000..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-action.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-consumer.xml b/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-consumer.xml
deleted file mode 100644
index 6dd555c68f9..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/main/resources/META-INF/spring/dubbo-demo-consumer.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/test/java/com/alibaba/dubbo/demo/consumer/DemoConsumer.java b/dubbo-demo/dubbo-demo-consumer/src/test/java/com/alibaba/dubbo/demo/consumer/DemoConsumer.java
deleted file mode 100644
index 3e414ff36c1..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/test/java/com/alibaba/dubbo/demo/consumer/DemoConsumer.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- * Copyright 1999-2011 Alibaba Group.
- *
- * 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 com.alibaba.dubbo.demo.consumer;
-
-public class DemoConsumer {
-
- public static void main(String[] args) {
- com.alibaba.dubbo.container.Main.main(args);
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-consumer/src/test/java/com/alibaba/dubbo/demo/consumer/RestClient.java b/dubbo-demo/dubbo-demo-consumer/src/test/java/com/alibaba/dubbo/demo/consumer/RestClient.java
deleted file mode 100644
index b8fd5fddba8..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/test/java/com/alibaba/dubbo/demo/consumer/RestClient.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.consumer;
-
-import com.alibaba.dubbo.demo.user.User;
-
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ClientBuilder;
-import javax.ws.rs.client.Entity;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-
-/**
- * @author lishen
- */
-public class RestClient {
-
- public static void main(String[] args) {
- final String port = "8888";
-// final String port = "8080";
-
-// for (int i = 0; i < 500; i++) {
-// final int index = i + 1;
-// new Thread(new Runnable() {
-// public void run() {
-// System.out.println("Starting thread " + index + "...");
-// for (int j = 0; j < 500; j++) {
- registerUser("http://localhost:" + port + "/services/users/register.json", MediaType.APPLICATION_JSON_TYPE);
-
- registerUser("http://localhost:" + port + "/services/users/register.xml", MediaType.TEXT_XML_TYPE);
-
- getUser("http://localhost:" + port + "/services/users/1.json");
-
- getUser("http://localhost:" + port + "/services/users/2.xml");
-
- registerUser("http://localhost:" + port + "/services/u/register.json", MediaType.APPLICATION_JSON_TYPE);
-
- registerUser("http://localhost:" + port + "/services/u/register.xml", MediaType.TEXT_XML_TYPE);
-
- getUser("http://localhost:" + port + "/services/u/1.json");
-
- getUser("http://localhost:" + port + "/services/u/2.xml");
-
- registerUser("http://localhost:" + port + "/services/customers/register.json", MediaType.APPLICATION_JSON_TYPE);
-
- registerUser("http://localhost:" + port + "/services/customers/register.xml", MediaType.TEXT_XML_TYPE);
-
- getUser("http://localhost:" + port + "/services/customers/1.json");
-
- getUser("http://localhost:" + port + "/services/customers/2.xml");
-// }
-// }
-// }).start();
-// }
- }
-
- private static void registerUser(String url, MediaType mediaType) {
- System.out.println("Registering user via " + url);
- User user = new User(1L, "larrypage");
- Client client = ClientBuilder.newClient();
- WebTarget target = client.target(url);
- Response response = target.request().post(Entity.entity(user, mediaType));
-
- try {
- if (response.getStatus() != 200) {
- throw new RuntimeException("Failed with HTTP error code : " + response.getStatus());
- }
- System.out.println("Successfully got result: " + response.readEntity(String.class));
- } finally {
- response.close();
- client.close();
- }
- }
-
- private static void getUser(String url) {
- System.out.println("Getting user via " + url);
- Client client = ClientBuilder.newClient();
- WebTarget target = client.target(url);
- Response response = target.request().get();
- try {
- if (response.getStatus() != 200) {
- throw new RuntimeException("Failed with HTTP error code : " + response.getStatus());
- }
- System.out.println("Successfully got result: " + response.readEntity(String.class));
- } finally {
- response.close();
- client.close();
- }
- }
-}
diff --git a/dubbo-demo/dubbo-demo-consumer/src/test/resources/log4j.xml b/dubbo-demo/dubbo-demo-consumer/src/test/resources/log4j.xml
deleted file mode 100644
index 7d716346409..00000000000
--- a/dubbo-demo/dubbo-demo-consumer/src/test/resources/log4j.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/pom.xml b/dubbo-demo/dubbo-demo-provider/pom.xml
index 1d6192f7aec..ce10b482e82 100644
--- a/dubbo-demo/dubbo-demo-provider/pom.xml
+++ b/dubbo-demo/dubbo-demo-provider/pom.xml
@@ -1,28 +1,13 @@
-
4.0.0
com.alibaba
dubbo-demo
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-demo-provider
- war
+ jar
${project.artifactId}
The demo provider module of dubbo project
@@ -34,206 +19,5 @@
dubbo-demo-api
${project.parent.version}
-
- com.alibaba
- dubbo
- ${project.parent.version}
-
-
- org.javassist
- javassist
-
-
- io.netty
- netty
-
-
- org.apache.mina
- mina-core
-
-
- org.glassfish.grizzly
- grizzly-core
-
-
- org.apache.httpcomponents
- httpclient
-
-
- com.alibaba
- fastjson
-
-
- com.thoughtworks.xstream
- xstream
-
-
- org.apache.bsf
- bsf-api
-
-
- org.apache.zookeeper
- zookeeper
-
-
- com.github.sgroschupf
- zkclient
-
-
- org.apache.curator
- curator-framework
-
-
- com.googlecode.xmemcached
- xmemcached
-
-
- org.apache.cxf
- cxf-rt-frontend-simple
-
-
- org.apache.cxf
- cxf-rt-transports-http
-
-
- org.apache.thrift
- libthrift
-
-
- com.caucho
- hessian
-
-
- javax.servlet
- javax.servlet-api
-
-
- org.mortbay.jetty
- jetty
-
-
- org.mortbay.jetty
- servlet-api
-
-
-
-
- log4j
- log4j
-
-
- org.slf4j
- slf4j-api
-
-
- redis.clients
- jedis
-
-
- javax.validation
- validation-api
-
-
- org.hibernate
- hibernate-validator
-
-
- javax.cache
- cache-api
-
-
-
- org.jboss.resteasy
- resteasy-jaxrs
-
-
-
- org.jboss.resteasy
- resteasy-client
-
-
-
- org.jboss.resteasy
- resteasy-netty
-
-
-
- org.jboss.resteasy
- resteasy-jdk-http
-
-
-
- org.jboss.resteasy
- resteasy-jackson-provider
-
-
-
- org.jboss.resteasy
- resteasy-jaxb-provider
-
-
-
- org.apache.tomcat.embed
- tomcat-embed-core
-
-
- org.apache.tomcat.embed
- tomcat-embed-logging-juli
-
-
-
- com.esotericsoftware.kryo
- kryo
-
-
- de.javakaffee
- kryo-serializers
-
-
- de.ruedigermoeller
- fst
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/bid/BidServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/bid/BidServiceImpl.java
deleted file mode 100644
index 391ffbc3a81..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/bid/BidServiceImpl.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.bid;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class BidServiceImpl implements BidService {
-
- public BidResponse bid(BidRequest request) {
- BidResponse response = new BidResponse();
-
- response.setId("abc");
-
- SeatBid seatBid = new SeatBid();
- seatBid.setGroup("group");
- seatBid.setSeat("seat");
- List seatBids = new ArrayList(1);
- seatBids.add(seatBid);
-
- response.setSeatBids(seatBids);
-
- return response;
- }
-
- public void throwNPE() throws NullPointerException {
- throw new NullPointerException();
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/UserServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/UserServiceImpl.java
deleted file mode 100644
index e722a01573f..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/UserServiceImpl.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user;
-
-import java.util.concurrent.atomic.AtomicLong;
-
-/**
- * @author lishen
- */
-public class UserServiceImpl implements UserService {
-
- private final AtomicLong idGen = new AtomicLong();
-
- public User getUser(Long id) {
- return new User(id, "username" + id);
- }
-
-
- public Long registerUser(User user) {
-// System.out.println("Username is " + user.getName());
- return idGen.incrementAndGet();
- }
-}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/AnnotationDrivenUserRestServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/AnnotationDrivenUserRestServiceImpl.java
deleted file mode 100644
index e7dd278dacd..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/AnnotationDrivenUserRestServiceImpl.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user.facade;
-
-import com.alibaba.dubbo.config.annotation.Service;
-import com.alibaba.dubbo.demo.user.User;
-import com.alibaba.dubbo.demo.user.UserService;
-import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
-import org.springframework.beans.factory.annotation.Autowired;
-
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-/**
- * @author lishen
- */
-@Service(protocol = {"rest", "dubbo"}, group = "annotationConfig", validation = "true")
-@Path("customers")
-@Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
-@Produces({ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
-public class AnnotationDrivenUserRestServiceImpl implements UserRestService {
-
-// private static final Logger logger = LoggerFactory.getLogger(UserRestServiceImpl.class);
-
- @Autowired
- private UserService userService;
-
- public void setUserService(UserService userService) {
- this.userService = userService;
- }
-
- @GET
- @Path("{id : \\d+}")
- public User getUser(@PathParam("id") Long id/*, @Context HttpServletRequest request*/) {
- // test context injection
-// System.out.println("Client address from @Context injection: " + (request != null ? request.getRemoteAddr() : ""));
-// System.out.println("Client address from RpcContext: " + RpcContext.getContext().getRemoteAddressString());
- return userService.getUser(id);
- }
-
- @POST
- @Path("register")
- public RegistrationResult registerUser(User user) {
- return new RegistrationResult(userService.registerUser(user));
- }
-}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/AnotherUserRestServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/AnotherUserRestServiceImpl.java
deleted file mode 100644
index 23a1ba282e2..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/AnotherUserRestServiceImpl.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user.facade;
-
-import com.alibaba.dubbo.demo.user.User;
-import com.alibaba.dubbo.demo.user.UserService;
-import com.alibaba.dubbo.rpc.RpcContext;
-
-/**
- * @author lishen
- */
-public class AnotherUserRestServiceImpl implements AnotherUserRestService {
-
- private UserService userService;
-
- public void setUserService(UserService userService) {
- this.userService = userService;
- }
-
- public User getUser(Long id) {
- System.out.println("Client name is " + RpcContext.getContext().getAttachment("clientName"));
- System.out.println("Client impl is " + RpcContext.getContext().getAttachment("clientImpl"));
- return userService.getUser(id);
- }
-
- public RegistrationResult registerUser(User user) {
- return new RegistrationResult(userService.registerUser(user));
- }
-}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/UserRestServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/UserRestServiceImpl.java
deleted file mode 100644
index 659a8203510..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/java/com/alibaba/dubbo/demo/user/facade/UserRestServiceImpl.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * Copyright 1999-2014 dangdang.com.
- *
- * 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 com.alibaba.dubbo.demo.user.facade;
-
-import com.alibaba.dubbo.demo.user.User;
-import com.alibaba.dubbo.demo.user.UserService;
-import com.alibaba.dubbo.demo.user.facade.RegistrationResult;
-import com.alibaba.dubbo.demo.user.facade.UserRestService;
-import com.alibaba.dubbo.rpc.RpcContext;
-import com.alibaba.dubbo.rpc.protocol.rest.support.ContentType;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.MediaType;
-
-/**
- * @author lishen
- */
-@Path("users")
-@Consumes({MediaType.APPLICATION_JSON, MediaType.TEXT_XML})
-@Produces({ContentType.APPLICATION_JSON_UTF_8, ContentType.TEXT_XML_UTF_8})
-public class UserRestServiceImpl implements UserRestService {
-
-// private static final Logger logger = LoggerFactory.getLogger(UserRestServiceImpl.class);
-
- private UserService userService;
-
- public void setUserService(UserService userService) {
- this.userService = userService;
- }
-
- @GET
- @Path("{id : \\d+}")
- public User getUser(@PathParam("id") Long id/*, @Context HttpServletRequest request*/) {
- // test context injection
-// System.out.println("Client address from @Context injection: " + (request != null ? request.getRemoteAddr() : ""));
-// System.out.println("Client address from RpcContext: " + RpcContext.getContext().getRemoteAddressString());
- if (RpcContext.getContext().getRequest(HttpServletRequest.class) != null) {
- System.out.println("Client IP address from RpcContext: " + RpcContext.getContext().getRequest(HttpServletRequest.class).getRemoteAddr());
- }
- if (RpcContext.getContext().getResponse(HttpServletResponse.class) != null) {
- System.out.println("Response object from RpcContext: " + RpcContext.getContext().getResponse(HttpServletResponse.class));
- }
- return userService.getUser(id);
- }
-
- @POST
- @Path("register")
- public RegistrationResult registerUser(User user) {
- return new RegistrationResult(userService.registerUser(user));
- }
-}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/DubboDemoProvider.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/DubboDemoProvider.java
new file mode 100644
index 00000000000..65e38969561
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/DubboDemoProvider.java
@@ -0,0 +1,25 @@
+package com.cnblogs.yjmyzz.demo.service.impl;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.context.ConfigurableApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+/**
+ * Created by yangjunming on 2016/11/3.
+ */
+public class DubboDemoProvider {
+
+ private static Logger logger = LoggerFactory.getLogger(DubboDemoProvider.class);
+
+ public static void main(String[] args) throws InterruptedException {
+
+ ConfigurableApplicationContext ctx = new ClassPathXmlApplicationContext("spring-context.xml");
+
+ logger.info("server started ...");
+
+ while (true) {
+ Thread.sleep(100);
+ }
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/avro/HelloServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/avro/HelloServiceImpl.java
new file mode 100644
index 00000000000..9ebcaa37428
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/avro/HelloServiceImpl.java
@@ -0,0 +1,17 @@
+package com.cnblogs.yjmyzz.demo.service.impl.avro;
+
+import com.cnblogs.yjmyzz.demo.service.api.avro.AvroHelloService;
+import org.apache.avro.AvroRemoteException;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by yangjunming on 2016/11/3.
+ */
+@Service("avroService")
+public class HelloServiceImpl implements AvroHelloService {
+
+ @Override
+ public CharSequence ping() throws AvroRemoteException {
+ return "avro service is running...";
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/dubbo/HelloServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/dubbo/HelloServiceImpl.java
new file mode 100644
index 00000000000..5906d679467
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/dubbo/HelloServiceImpl.java
@@ -0,0 +1,23 @@
+package com.cnblogs.yjmyzz.demo.service.impl.dubbo;
+
+
+import com.cnblogs.yjmyzz.demo.service.api.dubbo.DubboHelloService;
+import com.cnblogs.yjmyzz.demo.service.api.dubbo.User;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by yangjunming on 2016/11/3.
+ */
+@Service("dubboService")
+public class HelloServiceImpl implements DubboHelloService {
+
+ @Override
+ public String ping() {
+ return "dubbo service is running...";
+ }
+
+ @Override
+ public String register(User user) {
+ return String.format("%s register ok!", user.getUserName());
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/grpc/HelloServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/grpc/HelloServiceImpl.java
new file mode 100644
index 00000000000..eb45084c55d
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/grpc/HelloServiceImpl.java
@@ -0,0 +1,34 @@
+package com.cnblogs.yjmyzz.demo.service.impl.grpc;
+
+import com.alibaba.dubbo.rpc.protocol.grpc.GrpcBindableService;
+import com.cnblogs.yjmyzz.demo.service.api.grpc.GrpcHelloServiceGrpc;
+import com.cnblogs.yjmyzz.demo.service.api.grpc.PingRequest;
+import com.cnblogs.yjmyzz.demo.service.api.grpc.PingResponse;
+import io.grpc.Channel;
+import io.grpc.stub.StreamObserver;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by yangjunming on 2016/11/3.
+ */
+@Service("grpcService")
+public class HelloServiceImpl extends GrpcHelloServiceGrpc.GrpcHelloServiceImplBase implements GrpcBindableService {
+
+ private Channel channel;
+
+ public Channel getChannel() {
+ return channel;
+ }
+
+ public void setChannel(Channel channel) {
+ this.channel = channel;
+ }
+
+ @Override
+ public void ping(PingRequest request,
+ StreamObserver responseObserver) {
+ PingResponse reply = PingResponse.newBuilder().setMessage("grpc is running").build();
+ responseObserver.onNext(reply);
+ responseObserver.onCompleted();
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/rest/HelloServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/rest/HelloServiceImpl.java
new file mode 100644
index 00000000000..4356887237c
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/rest/HelloServiceImpl.java
@@ -0,0 +1,27 @@
+package com.cnblogs.yjmyzz.demo.service.impl.rest;
+
+import com.cnblogs.yjmyzz.demo.service.api.dubbo.DubboHelloService;
+import com.cnblogs.yjmyzz.demo.service.api.dubbo.User;
+import com.cnblogs.yjmyzz.demo.service.api.rest.RestHelloService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by yangjunming on 2016/11/3.
+ */
+@Service("restService")
+public class HelloServiceImpl implements RestHelloService {
+
+ @Autowired
+ DubboHelloService dubboHelloService;
+
+ @Override
+ public String ping() {
+ return dubboHelloService.ping();
+ }
+
+ @Override
+ public String register(User user) {
+ return dubboHelloService.register(user);
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/thrift/HelloServiceImpl.java b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/thrift/HelloServiceImpl.java
new file mode 100644
index 00000000000..b9351c0b52c
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/java/com/cnblogs/yjmyzz/demo/service/impl/thrift/HelloServiceImpl.java
@@ -0,0 +1,17 @@
+package com.cnblogs.yjmyzz.demo.service.impl.thrift;
+
+import com.cnblogs.yjmyzz.demo.service.api.thrift.ThriftHelloService;
+import org.apache.thrift.TException;
+import org.springframework.stereotype.Service;
+
+/**
+ * Created by yangjunming on 2016/11/3.
+ */
+@Service("thriftService")
+public class HelloServiceImpl implements ThriftHelloService.Iface {
+
+ @Override
+ public String ping() throws TException {
+ return "thrift service is running...";
+ }
+}
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Protocol b/dubbo-demo/dubbo-demo-provider/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Protocol
new file mode 100644
index 00000000000..ea30049702a
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.rpc.Protocol
@@ -0,0 +1,3 @@
+grpc=com.alibaba.dubbo.rpc.protocol.grpc.GrpcProtocol
+thrift2=com.alibaba.dubbo.rpc.protocol.thrift2.Thrift2Protocol
+avro=com.alibaba.dubbo.rpc.protocol.avro.AvroProtocol
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml b/dubbo-demo/dubbo-demo-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
deleted file mode 100644
index 265645ab00b..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/resources/META-INF/spring/dubbo-demo-provider.xml
+++ /dev/null
@@ -1,84 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/resources/log4j.xml b/dubbo-demo/dubbo-demo-provider/src/main/resources/log4j.xml
deleted file mode 100644
index ae988c35f13..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/resources/log4j.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/resources/log4j2.xml b/dubbo-demo/dubbo-demo-provider/src/main/resources/log4j2.xml
new file mode 100644
index 00000000000..ccf6466706c
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/resources/log4j2.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/resources/spring-context.xml b/dubbo-demo/dubbo-demo-provider/src/main/resources/spring-context.xml
new file mode 100644
index 00000000000..e59a14c1c71
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/resources/spring-context.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/resources/spring-dubbo-provider.xml b/dubbo-demo/dubbo-demo-provider/src/main/resources/spring-dubbo-provider.xml
new file mode 100644
index 00000000000..4decb31aa9b
--- /dev/null
+++ b/dubbo-demo/dubbo-demo-provider/src/main/resources/spring-dubbo-provider.xml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/main/webapp/WEB-INF/web.xml b/dubbo-demo/dubbo-demo-provider/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 9a355c15ffc..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
- contextConfigLocation
- /WEB-INF/classes/META-INF/spring/dubbo-demo-provider.xml
-
-
-
-
- com.alibaba.dubbo.remoting.http.servlet.BootstrapListener
-
-
-
- org.springframework.web.context.ContextLoaderListener
-
-
-
- dispatcher
- com.alibaba.dubbo.remoting.http.servlet.DispatcherServlet
- 1
-
-
-
- dispatcher
- /services/*
-
-
\ No newline at end of file
diff --git a/dubbo-demo/dubbo-demo-provider/src/test/java/com/alibaba/dubbo/demo/provider/DemoProvider.java b/dubbo-demo/dubbo-demo-provider/src/test/java/com/alibaba/dubbo/demo/provider/DemoProvider.java
deleted file mode 100644
index b00688c9efc..00000000000
--- a/dubbo-demo/dubbo-demo-provider/src/test/java/com/alibaba/dubbo/demo/provider/DemoProvider.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright 1999-2011 Alibaba Group.
- *
- * 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 com.alibaba.dubbo.demo.provider;
-
-import com.alibaba.dubbo.config.ProtocolConfig;
-
-public class DemoProvider {
-
- public static void main(String[] args) {
-// new Thread(new Runnable() {
-// public void run() {
-// try {
-// Thread.sleep(20000);
-// } catch (InterruptedException e) {
-// e.printStackTrace();
-// }
-// ProtocolConfig.destroyAll();
-// }
-// }).start();
- com.alibaba.dubbo.container.Main.main(args);
- }
-
-}
\ No newline at end of file
diff --git a/dubbo-demo/pom.xml b/dubbo-demo/pom.xml
index 4d77e14ec9a..a805cec8f76 100644
--- a/dubbo-demo/pom.xml
+++ b/dubbo-demo/pom.xml
@@ -1,5 +1,5 @@
- 4.0.0
-
- com.alibaba
- dubbo-parent
- 2.8.4
-
- dubbo-demo
- pom
- ${project.artifactId}
- The demo module of dubbo project
-
- true
-
-
- dubbo-demo-api
- dubbo-demo-provider
- dubbo-demo-consumer
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ 4.0.0
+
+ com.alibaba
+ dubbo-parent
+ 2.8.5-SNAPSHOT
+
+ dubbo-demo
+ pom
+ ${project.artifactId}
+ The demo module of dubbo project
+
+ true
+
+
+ dubbo-demo-api
+ dubbo-demo-provider
+ dubbo-demo-consumer
+
+
+
+
+
+
+ org.springframework
+ spring-core
+ 4.2.5.RELEASE
+
+
+
+ org.springframework
+ spring-beans
+ 4.2.5.RELEASE
+
+
+
+ org.springframework
+ spring-context
+ 4.2.5.RELEASE
+
+
+
+ org.springframework
+ spring-context-support
+ 4.2.5.RELEASE
+
+
+
+
+ com.alibaba
+ dubbo
+ 2.8.5-SNAPSHOT
+
+
+ log4j
+ log4j
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+
+
+
+
+ org.jboss.resteasy
+ resteasy-client
+ 3.0.9.Final
+
+
+
+ org.jboss.resteasy
+ resteasy-jaxrs
+ 3.0.9.Final
+
+
+
+ org.jboss.resteasy
+ resteasy-netty
+ 3.0.14.Final
+
+
+
+ org.jboss.resteasy
+ resteasy-multipart-provider
+ 3.0.14.Final
+
+
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-core
+ 8.0.11
+
+
+
+ org.apache.tomcat.embed
+ tomcat-embed-logging-juli
+ 8.0.11
+
+
+
+
+ javax.servlet
+ javax.servlet-api
+ 3.1.0
+
+
+
+ javax.validation
+ validation-api
+ 1.1.0.Final
+
+
+
+
+ org.apache.zookeeper
+ zookeeper
+ 3.4.8
+
+
+ org.slf4j
+ slf4j-log4j12
+
+
+ log4j
+ log4j
+
+
+
+
+
+ com.alibaba
+ zkclient
+ 0.8.1
+
+
+
+
+ org.jboss.resteasy
+ resteasy-jackson-provider
+ 3.0.14.Final
+
+
+
+ org.jboss.resteasy
+ resteasy-jaxb-provider
+ 3.0.16.Final
+
+
+
+
+ org.apache.thrift
+ libthrift
+ 0.9.3
+
+
+
+
+ io.grpc
+ grpc-netty
+ 1.0.1
+
+
+ io.grpc
+ grpc-protobuf
+ 1.0.1
+
+
+ io.grpc
+ grpc-stub
+ 1.0.1
+
+
+ com.google.protobuf
+ protobuf-java
+ 3.1.0
+
+
+ com.google.guava
+ guava
+ 19.0
+
+
+
+
+ org.apache.avro
+ avro
+ 1.8.1
+
+
+ org.apache.avro
+ avro-ipc
+ 1.8.1
+
+
+
+
+ org.apache.logging.log4j
+ log4j-core
+ 2.7
+
+
+
+ org.apache.logging.log4j
+ log4j-slf4j-impl
+ 2.7
+
+
+
diff --git a/dubbo-filter/dubbo-filter-cache/pom.xml b/dubbo-filter/dubbo-filter-cache/pom.xml
index 8431bef623d..9932dea7d68 100644
--- a/dubbo-filter/dubbo-filter-cache/pom.xml
+++ b/dubbo-filter/dubbo-filter-cache/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-filter
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-filter-cache
jar
diff --git a/dubbo-filter/dubbo-filter-validation/pom.xml b/dubbo-filter/dubbo-filter-validation/pom.xml
index d3d9cc12134..402d6306f5c 100644
--- a/dubbo-filter/dubbo-filter-validation/pom.xml
+++ b/dubbo-filter/dubbo-filter-validation/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-filter
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-filter-validation
jar
diff --git a/dubbo-filter/pom.xml b/dubbo-filter/pom.xml
index 86e2ef12fbf..7debf871ee3 100644
--- a/dubbo-filter/pom.xml
+++ b/dubbo-filter/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-parent
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-filter
pom
diff --git a/dubbo-maven/pom.xml b/dubbo-maven/pom.xml
deleted file mode 100644
index 68893fdf6c6..00000000000
--- a/dubbo-maven/pom.xml
+++ /dev/null
@@ -1,354 +0,0 @@
-
-
- 4.0.0
-
- org.sonatype.oss
- oss-parent
- 7
-
- com.alibaba
- dubbo
- 2.4.3
- jar
- Dubbo
- Dubbo is a distributed service framework enpowers applications with service import/export capability with high performance RPC.
- http://code.alibabatech.com/wiki/display/dubbo
- 2012
-
-
- Apache 2
- http://www.apache.org/licenses/LICENSE-2.0.txt
- repo
- A business-friendly OSS license
-
-
-
- Alibaba
- http://www.alibaba.com
-
-
-
- org.springframework
- spring
- 2.5.6.SEC03
-
-
- org.javassist
- javassist
- 3.15.0-GA
-
-
- io.netty
- netty
- 3.2.5.Final
-
-
- org.apache.mina
- mina-core
- 1.1.7
- provided
-
-
- org.glassfish.grizzly
- grizzly-core
- 2.1.4
- provided
-
-
- org.apache.httpcomponents
- httpclient
- 4.1.2
- provided
-
-
- com.alibaba
- fastjson
- 1.1.18
- provided
-
-
- com.thoughtworks.xstream
- xstream
- 1.4.1
- provided
-
-
- org.apache.bsf
- bsf-api
- 3.1
- provided
-
-
- org.apache.zookeeper
- zookeeper
- 3.3.3
- provided
-
-
- com.github.sgroschupf
- zkclient
- 0.1
- provided
-
-
- com.netflix.curator
- curator-framework
- 1.1.10
- provided
-
-
- com.googlecode.xmemcached
- xmemcached
- 1.3.6
- provided
-
-
- org.apache.cxf
- cxf-rt-frontend-simple
- 2.6.1
- provided
-
-
- org.apache.cxf
- cxf-rt-transports-http
- 2.6.1
- provided
-
-
- org.apache.thrift
- libthrift
- 0.8.0
- provided
-
-
- com.caucho
- hessian
- 4.0.7
- provided
-
-
- javax.servlet
- javax.servlet-api
- 2.5
- provided
-
-
- org.mortbay.jetty
- jetty
- 6.1.26
- provided
-
-
- log4j
- log4j
- 1.2.16
- provided
-
-
- org.slf4j
- slf4j-api
- 1.6.2
- provided
-
-
- redis.clients
- jedis
- 2.0.0
- provided
-
-
- javax.validation
- validation-api
- 1.0.0.GA
- provided
-
-
- org.hibernate
- hibernate-validator
- 4.2.0.Final
- provided
-
-
- javax.cache
- cache-api
- 0.4
- provided
-
-
- ch.qos.logback
- logback-classic
- 1.0.6
- provided
-
-
-
-
-
- maven-source-plugin
-
-
- attach-sources
-
- jar
-
-
-
-
-
- maven-compiler-plugin
-
-
- 1.5
- UTF-8
-
-
-
- maven-jar-plugin
-
-
- true
- true
-
- true
- true
-
-
-
-
-
- maven-javadoc-plugin
-
-
- attach-javadoc
-
- jar
-
-
-
-
- public
- UTF-8
- UTF-8
- UTF-8
- com.alibaba.com.*
-
- http://docs.oracle.com/javase/6/docs/api
-
-
-
-
- maven-gpg-plugin
-
-
- sign-artifacts
- verify
-
- sign
-
-
-
-
-
-
-
- true
-
-
- jira
- http://code.alibabatech.com/jira/browse/DUBBO
-
-
- http://code.alibabatech.com/svn/dubbo/trunk
- scm:svn:http://code.alibabatech.com/svn/dubbo/trunk
- scm:svn:http://code.alibabatech.com/svn/dubbo/trunk
-
-
-
- Dubbo User Mailling List
- dubbo-subscribe AT googlegroups DOT com
- dubbo-unsubscribe AT googlegroups DOT com
- dubbo AT googlegroups DOT com
- http://groups.google.com/group/dubbo
-
-
-
-
- QianXiao(Shawn)
- shawn.qianx
- shawn.qianx (AT) alibaba-inc.com
-
- Developer
-
- +8
-
-
- LiangFei(William)
- william.liangf
- william.liangf (AT) alibaba-inc.com
-
- Developer
-
- +8
-
-
- LiDing(Jerry)
- ding.lid
- ding.lid (AT) alibaba-inc.com
-
- Developer
-
- +8
-
-
- LiuChao(Charles)
- chao.liuc
- chao.liuc (AT) alibaba-inc.com
-
- Developer
-
- +8
-
-
- LiuHaoMin(Ludvik)
- haoming.liuhm
- haoming.liuhm (AT) alibaba-inc.com
-
- Developer
-
- +8
-
-
- ChenLei(Tony)
- tony.chenl
- tony.chenl (AT) alibaba-inc.com
-
- Developer
-
- +8
-
-
- LuGang(Kimi)
- gang.lvgm
- gang.lvgm (AT) alibaba-inc.com
-
- Developer
-
- +8
-
-
-
diff --git a/dubbo-monitor/dubbo-monitor-api/pom.xml b/dubbo-monitor/dubbo-monitor-api/pom.xml
index e654f038a54..5d6dcadb9e5 100644
--- a/dubbo-monitor/dubbo-monitor-api/pom.xml
+++ b/dubbo-monitor/dubbo-monitor-api/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-monitor
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-monitor-api
jar
diff --git a/dubbo-monitor/dubbo-monitor-default/pom.xml b/dubbo-monitor/dubbo-monitor-default/pom.xml
index 957fda3e422..2668f833804 100644
--- a/dubbo-monitor/dubbo-monitor-default/pom.xml
+++ b/dubbo-monitor/dubbo-monitor-default/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-monitor
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-monitor-default
jar
diff --git a/dubbo-monitor/pom.xml b/dubbo-monitor/pom.xml
index 5061c3f5606..217c71764a3 100644
--- a/dubbo-monitor/pom.xml
+++ b/dubbo-monitor/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-parent
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-monitor
pom
diff --git a/dubbo-registry/dubbo-registry-api/pom.xml b/dubbo-registry/dubbo-registry-api/pom.xml
index 25572a8b656..9342cdcb250 100644
--- a/dubbo-registry/dubbo-registry-api/pom.xml
+++ b/dubbo-registry/dubbo-registry-api/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-registry
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-registry-api
jar
diff --git a/dubbo-registry/dubbo-registry-default/pom.xml b/dubbo-registry/dubbo-registry-default/pom.xml
index 2ee2515bed9..c8db6ea851d 100644
--- a/dubbo-registry/dubbo-registry-default/pom.xml
+++ b/dubbo-registry/dubbo-registry-default/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-registry
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-registry-default
jar
@@ -40,12 +40,12 @@
${project.parent.version}
test
-
- com.alibaba
- dubbo-rpc-injvm
- ${project.parent.version}
- test
-
+
+
+
+
+
+
com.alibaba
dubbo-remoting-netty
diff --git a/dubbo-registry/dubbo-registry-multicast/pom.xml b/dubbo-registry/dubbo-registry-multicast/pom.xml
index 478d4fb67b7..e51af12fdf1 100644
--- a/dubbo-registry/dubbo-registry-multicast/pom.xml
+++ b/dubbo-registry/dubbo-registry-multicast/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-registry
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-registry-multicast
jar
diff --git a/dubbo-registry/dubbo-registry-multicast/src/main/java/com/alibaba/dubbo/registry/multicast/MulticastRegistry.java b/dubbo-registry/dubbo-registry-multicast/src/main/java/com/alibaba/dubbo/registry/multicast/MulticastRegistry.java
index 5575e84e4f9..0fd8a3f8ac0 100644
--- a/dubbo-registry/dubbo-registry-multicast/src/main/java/com/alibaba/dubbo/registry/multicast/MulticastRegistry.java
+++ b/dubbo-registry/dubbo-registry-multicast/src/main/java/com/alibaba/dubbo/registry/multicast/MulticastRegistry.java
@@ -15,25 +15,6 @@
*/
package com.alibaba.dubbo.registry.multicast;
-import java.io.IOException;
-import java.net.DatagramPacket;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.MulticastSocket;
-import java.net.Socket;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.Executors;
-import java.util.concurrent.ScheduledExecutorService;
-import java.util.concurrent.ScheduledFuture;
-import java.util.concurrent.TimeUnit;
-
import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.logger.Logger;
@@ -41,11 +22,15 @@
import com.alibaba.dubbo.common.utils.ConcurrentHashSet;
import com.alibaba.dubbo.common.utils.NamedThreadFactory;
import com.alibaba.dubbo.common.utils.NetUtils;
-import com.alibaba.dubbo.common.utils.StringUtils;
import com.alibaba.dubbo.common.utils.UrlUtils;
import com.alibaba.dubbo.registry.NotifyListener;
import com.alibaba.dubbo.registry.support.FailbackRegistry;
+import java.io.IOException;
+import java.net.*;
+import java.util.*;
+import java.util.concurrent.*;
+
/**
* MulticastRegistry
*
@@ -79,7 +64,7 @@ public MulticastRegistry(URL url) {
if (url.isAnyHost()) {
throw new IllegalStateException("registry address == null");
}
- if (! isMulticastAddress(url.getHost())) {
+ if (! NetUtils.isMulticastAddress(url.getHost())) {
throw new IllegalArgumentException("Invalid multicast address " + url.getHost() + ", scope: 224.0.0.0 - 239.255.255.255");
}
try {
@@ -131,17 +116,17 @@ public void run() {
}
}
- private static boolean isMulticastAddress(String ip) {
- int i = ip.indexOf('.');
- if (i > 0) {
- String prefix = ip.substring(0, i);
- if (StringUtils.isInteger(prefix)) {
- int p = Integer.parseInt(prefix);
- return p >= 224 && p <= 239;
- }
- }
- return false;
- }
+// private static boolean isMulticastAddress(String ip) {
+// int i = ip.indexOf('.');
+// if (i > 0) {
+// String prefix = ip.substring(0, i);
+// if (StringUtils.isInteger(prefix)) {
+// int p = Integer.parseInt(prefix);
+// return p >= 224 && p <= 239;
+// }
+// }
+// return false;
+// }
private void clean() {
if (admin) {
diff --git a/dubbo-registry/dubbo-registry-redis/pom.xml b/dubbo-registry/dubbo-registry-redis/pom.xml
index 10c9fa26b49..fe3ddf6cd33 100644
--- a/dubbo-registry/dubbo-registry-redis/pom.xml
+++ b/dubbo-registry/dubbo-registry-redis/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-registry
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-registry-redis
jar
diff --git a/dubbo-registry/dubbo-registry-zookeeper/pom.xml b/dubbo-registry/dubbo-registry-zookeeper/pom.xml
index 774d0b73bda..3ddc7e5b9f0 100644
--- a/dubbo-registry/dubbo-registry-zookeeper/pom.xml
+++ b/dubbo-registry/dubbo-registry-zookeeper/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-registry
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-registry-zookeeper
jar
diff --git a/dubbo-registry/dubbo-registry-zookeeper/src/main/java/com/alibaba/dubbo/registry/zookeeper/ZookeeperRegistry.java b/dubbo-registry/dubbo-registry-zookeeper/src/main/java/com/alibaba/dubbo/registry/zookeeper/ZookeeperRegistry.java
index 1a39435f964..ecf42042c65 100644
--- a/dubbo-registry/dubbo-registry-zookeeper/src/main/java/com/alibaba/dubbo/registry/zookeeper/ZookeeperRegistry.java
+++ b/dubbo-registry/dubbo-registry-zookeeper/src/main/java/com/alibaba/dubbo/registry/zookeeper/ZookeeperRegistry.java
@@ -15,12 +15,6 @@
*/
package com.alibaba.dubbo.registry.zookeeper;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-
import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.common.logger.Logger;
@@ -30,14 +24,20 @@
import com.alibaba.dubbo.registry.NotifyListener;
import com.alibaba.dubbo.registry.support.FailbackRegistry;
import com.alibaba.dubbo.remoting.zookeeper.ChildListener;
-import com.alibaba.dubbo.remoting.zookeeper.ZookeeperClient;
import com.alibaba.dubbo.remoting.zookeeper.StateListener;
+import com.alibaba.dubbo.remoting.zookeeper.ZookeeperClient;
import com.alibaba.dubbo.remoting.zookeeper.ZookeeperTransporter;
import com.alibaba.dubbo.rpc.RpcException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
+
/**
* ZookeeperRegistry
- *
+ *
* @author william.liangf
*/
public class ZookeeperRegistry extends FailbackRegistry {
@@ -45,37 +45,37 @@ public class ZookeeperRegistry extends FailbackRegistry {
private final static Logger logger = LoggerFactory.getLogger(ZookeeperRegistry.class);
private final static int DEFAULT_ZOOKEEPER_PORT = 2181;
-
+
private final static String DEFAULT_ROOT = "dubbo";
- private final String root;
-
+ private final String root;
+
private final Set anyServices = new ConcurrentHashSet();
private final ConcurrentMap> zkListeners = new ConcurrentHashMap>();
-
+
private final ZookeeperClient zkClient;
-
+
public ZookeeperRegistry(URL url, ZookeeperTransporter zookeeperTransporter) {
super(url);
if (url.isAnyHost()) {
- throw new IllegalStateException("registry address == null");
- }
+ throw new IllegalStateException("registry address == null");
+ }
String group = url.getParameter(Constants.GROUP_KEY, DEFAULT_ROOT);
- if (! group.startsWith(Constants.PATH_SEPARATOR)) {
+ if (!group.startsWith(Constants.PATH_SEPARATOR)) {
group = Constants.PATH_SEPARATOR + group;
}
this.root = group;
zkClient = zookeeperTransporter.connect(url);
zkClient.addStateListener(new StateListener() {
public void stateChanged(int state) {
- if (state == RECONNECTED) {
- try {
- recover();
- } catch (Exception e) {
- logger.error(e.getMessage(), e);
- }
- }
+ if (state == RECONNECTED) {
+ try {
+ recover();
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ }
+ }
}
});
}
@@ -95,7 +95,7 @@ public void destroy() {
protected void doRegister(URL url) {
try {
- zkClient.create(toUrlPath(url), url.getParameter(Constants.DYNAMIC_KEY, true));
+ zkClient.create(toUrlPath(url), url.getParameter(Constants.DYNAMIC_KEY, true));
} catch (Throwable e) {
throw new RpcException("Failed to register " + url + " to zookeeper " + getUrl() + ", cause: " + e.getMessage(), e);
}
@@ -123,10 +123,10 @@ protected void doSubscribe(final URL url, final NotifyListener listener) {
listeners.putIfAbsent(listener, new ChildListener() {
public void childChanged(String parentPath, List currentChilds) {
for (String child : currentChilds) {
- child = URL.decode(child);
- if (! anyServices.contains(child)) {
+ child = URL.decode(child);
+ if (!anyServices.contains(child)) {
anyServices.add(child);
- subscribe(url.setPath(child).addParameters(Constants.INTERFACE_KEY, child,
+ subscribe(url.setPath(child).addParameters(Constants.INTERFACE_KEY, child,
Constants.CHECK_KEY, String.valueOf(false)), listener);
}
}
@@ -138,9 +138,9 @@ public void childChanged(String parentPath, List currentChilds) {
List services = zkClient.addChildListener(root, zkListener);
if (services != null && services.size() > 0) {
for (String service : services) {
- service = URL.decode(service);
- anyServices.add(service);
- subscribe(url.setPath(service).addParameters(Constants.INTERFACE_KEY, service,
+ service = URL.decode(service);
+ anyServices.add(service);
+ subscribe(url.setPath(service).addParameters(Constants.INTERFACE_KEY, service,
Constants.CHECK_KEY, String.valueOf(false)), listener);
}
}
@@ -156,7 +156,7 @@ public void childChanged(String parentPath, List currentChilds) {
if (zkListener == null) {
listeners.putIfAbsent(listener, new ChildListener() {
public void childChanged(String parentPath, List currentChilds) {
- ZookeeperRegistry.this.notify(url, listener, toUrlsWithEmpty(url, parentPath, currentChilds));
+ ZookeeperRegistry.this.notify(url, listener, toUrlsWithEmpty(url, parentPath, currentChilds));
}
});
zkListener = listeners.get(listener);
@@ -164,7 +164,7 @@ public void childChanged(String parentPath, List currentChilds) {
zkClient.create(path, false);
List children = zkClient.addChildListener(path, zkListener);
if (children != null) {
- urls.addAll(toUrlsWithEmpty(url, path, children));
+ urls.addAll(toUrlsWithEmpty(url, path, children));
}
}
notify(url, listener, urls);
@@ -191,28 +191,28 @@ public List lookup(URL url) {
try {
List providers = new ArrayList();
for (String path : toCategoriesPath(url)) {
- List children = zkClient.getChildren(path);
- if (children != null) {
- providers.addAll(children);
- }
+ List children = zkClient.getChildren(path);
+ if (children != null) {
+ providers.addAll(children);
+ }
}
return toUrlsWithoutEmpty(url, providers);
} catch (Throwable e) {
throw new RpcException("Failed to lookup " + url + " from zookeeper " + getUrl() + ", cause: " + e.getMessage(), e);
}
}
-
+
private String toRootDir() {
if (root.equals(Constants.PATH_SEPARATOR)) {
return root;
}
return root + Constants.PATH_SEPARATOR;
}
-
+
private String toRootPath() {
return root;
}
-
+
private String toServicePath(URL url) {
String name = url.getServiceInterface();
if (Constants.ANY_VALUE.equals(name)) {
@@ -224,13 +224,13 @@ private String toServicePath(URL url) {
private String[] toCategoriesPath(URL url) {
String[] categroies;
if (Constants.ANY_VALUE.equals(url.getParameter(Constants.CATEGORY_KEY))) {
- categroies = new String[] {Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY,
+ categroies = new String[]{Constants.PROVIDERS_CATEGORY, Constants.CONSUMERS_CATEGORY,
Constants.ROUTERS_CATEGORY, Constants.CONFIGURATORS_CATEGORY};
} else {
- categroies = url.getParameter(Constants.CATEGORY_KEY, new String[] {Constants.DEFAULT_CATEGORY});
+ categroies = url.getParameter(Constants.CATEGORY_KEY, new String[]{Constants.DEFAULT_CATEGORY});
}
String[] paths = new String[categroies.length];
- for (int i = 0; i < categroies.length; i ++) {
+ for (int i = 0; i < categroies.length; i++) {
paths[i] = toServicePath(url) + Constants.PATH_SEPARATOR + categroies[i];
}
return paths;
@@ -243,9 +243,9 @@ private String toCategoryPath(URL url) {
private String toUrlPath(URL url) {
return toCategoryPath(url) + Constants.PATH_SEPARATOR + URL.encode(url.toFullString());
}
-
+
private List toUrlsWithoutEmpty(URL consumer, List providers) {
- List urls = new ArrayList();
+ List urls = new ArrayList();
if (providers != null && providers.size() > 0) {
for (String provider : providers) {
provider = URL.decode(provider);
@@ -263,9 +263,9 @@ private List toUrlsWithoutEmpty(URL consumer, List providers) {
private List toUrlsWithEmpty(URL consumer, String path, List providers) {
List urls = toUrlsWithoutEmpty(consumer, providers);
if (urls.isEmpty()) {
- int i = path.lastIndexOf('/');
- String category = i < 0 ? path : path.substring(i + 1);
- URL empty = consumer.setProtocol(Constants.EMPTY_PROTOCOL).addParameter(Constants.CATEGORY_KEY, category);
+ int i = path.lastIndexOf('/');
+ String category = i < 0 ? path : path.substring(i + 1);
+ URL empty = consumer.setProtocol(Constants.EMPTY_PROTOCOL).addParameter(Constants.CATEGORY_KEY, category);
urls.add(empty);
}
return urls;
diff --git a/dubbo-registry/pom.xml b/dubbo-registry/pom.xml
index 4dedf4fc732..2c87426e5c2 100644
--- a/dubbo-registry/pom.xml
+++ b/dubbo-registry/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-parent
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-registry
pom
diff --git a/dubbo-remoting/dubbo-remoting-api/pom.xml b/dubbo-remoting/dubbo-remoting-api/pom.xml
index c8fe1460033..12b78d799cb 100644
--- a/dubbo-remoting/dubbo-remoting-api/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-api/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-remoting
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-remoting-api
jar
diff --git a/dubbo-remoting/dubbo-remoting-grizzly/pom.xml b/dubbo-remoting/dubbo-remoting-grizzly/pom.xml
index ce4b6520072..60e1d4b501a 100644
--- a/dubbo-remoting/dubbo-remoting-grizzly/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-grizzly/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-remoting
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-remoting-grizzly
jar
diff --git a/dubbo-remoting/dubbo-remoting-http/pom.xml b/dubbo-remoting/dubbo-remoting-http/pom.xml
index c08a31deb77..69cdabc07a9 100644
--- a/dubbo-remoting/dubbo-remoting-http/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-http/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-remoting
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-remoting-http
jar
diff --git a/dubbo-remoting/dubbo-remoting-mina/pom.xml b/dubbo-remoting/dubbo-remoting-mina/pom.xml
index b3e36966f1a..df1bbad852e 100644
--- a/dubbo-remoting/dubbo-remoting-mina/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-mina/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-remoting
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-remoting-mina
jar
diff --git a/dubbo-remoting/dubbo-remoting-netty/pom.xml b/dubbo-remoting/dubbo-remoting-netty/pom.xml
index afe4f789749..34328a4568d 100644
--- a/dubbo-remoting/dubbo-remoting-netty/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-netty/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-remoting
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-remoting-netty
jar
diff --git a/dubbo-remoting/dubbo-remoting-p2p/pom.xml b/dubbo-remoting/dubbo-remoting-p2p/pom.xml
index 0dce25f736f..3ee39816e5f 100644
--- a/dubbo-remoting/dubbo-remoting-p2p/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-p2p/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-remoting
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-remoting-p2p
jar
diff --git a/dubbo-remoting/dubbo-remoting-p2p/src/main/java/com/alibaba/dubbo/remoting/p2p/support/MulticastGroup.java b/dubbo-remoting/dubbo-remoting-p2p/src/main/java/com/alibaba/dubbo/remoting/p2p/support/MulticastGroup.java
index beca3ba9c96..d249ec49fe1 100644
--- a/dubbo-remoting/dubbo-remoting-p2p/src/main/java/com/alibaba/dubbo/remoting/p2p/support/MulticastGroup.java
+++ b/dubbo-remoting/dubbo-remoting-p2p/src/main/java/com/alibaba/dubbo/remoting/p2p/support/MulticastGroup.java
@@ -15,18 +15,18 @@
*/
package com.alibaba.dubbo.remoting.p2p.support;
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.common.utils.NetUtils;
+import com.alibaba.dubbo.remoting.ChannelHandler;
+import com.alibaba.dubbo.remoting.RemotingException;
+import com.alibaba.dubbo.remoting.p2p.Peer;
+
import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.MulticastSocket;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.common.utils.StringUtils;
-import com.alibaba.dubbo.remoting.ChannelHandler;
-import com.alibaba.dubbo.remoting.RemotingException;
-import com.alibaba.dubbo.remoting.p2p.Peer;
-
/**
* MulticastGroup
*
@@ -44,7 +44,7 @@ public class MulticastGroup extends AbstractGroup {
public MulticastGroup(URL url) {
super(url);
- if (! isMulticastAddress(url.getHost())) {
+ if (!NetUtils.isMulticastAddress(url.getHost())) {
throw new IllegalArgumentException("Invalid multicast address " + url.getHost() + ", scope: 224.0.0.0 - 239.255.255.255");
}
try {
@@ -73,17 +73,17 @@ public void run() {
}
}
- private static boolean isMulticastAddress(String ip) {
- int i = ip.indexOf('.');
- if (i > 0) {
- String prefix = ip.substring(0, i);
- if (StringUtils.isInteger(prefix)) {
- int p = Integer.parseInt(prefix);
- return p >= 224 && p <= 239;
- }
- }
- return false;
- }
+// private static boolean isMulticastAddress(String ip) {
+// int i = ip.indexOf('.');
+// if (i > 0) {
+// String prefix = ip.substring(0, i);
+// if (StringUtils.isInteger(prefix)) {
+// int p = Integer.parseInt(prefix);
+// return p >= 224 && p <= 239;
+// }
+// }
+// return false;
+// }
private void send(String msg) throws RemotingException {
DatagramPacket hi = new DatagramPacket(msg.getBytes(), msg.length(), mutilcastAddress, mutilcastSocket.getLocalPort());
diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml
index 47520dae0d8..0b9af3fc718 100644
--- a/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml
+++ b/dubbo-remoting/dubbo-remoting-zookeeper/pom.xml
@@ -14,37 +14,38 @@
- limitations under the License.
-->
- 4.0.0
-
- com.alibaba
- dubbo-remoting
- 2.8.4
-
- dubbo-remoting-zookeeper
- jar
- ${project.artifactId}
- The zookeeper remoting module of dubbo project
-
- true
-
-
-
- com.alibaba
- dubbo-common
- ${project.parent.version}
-
-
- org.apache.zookeeper
- zookeeper
-
-
- com.github.sgroschupf
- zkclient
-
-
- org.apache.curator
- curator-framework
-
-
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ 4.0.0
+
+ com.alibaba
+ dubbo-remoting
+ 2.8.5-SNAPSHOT
+
+ dubbo-remoting-zookeeper
+ jar
+ ${project.artifactId}
+ The zookeeper remoting module of dubbo project
+
+ true
+
+
+
+ com.alibaba
+ dubbo-common
+ ${project.parent.version}
+
+
+ org.apache.zookeeper
+ zookeeper
+
+
+ com.alibaba
+ zkclient
+ 0.8.1
+
+
+ org.apache.curator
+ curator-framework
+
+
\ No newline at end of file
diff --git a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/zkclient/ZkclientZookeeperClient.java b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/zkclient/ZkclientZookeeperClient.java
index f1f43e6ba68..d025ae6e45d 100644
--- a/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/zkclient/ZkclientZookeeperClient.java
+++ b/dubbo-remoting/dubbo-remoting-zookeeper/src/main/java/com/alibaba/dubbo/remoting/zookeeper/zkclient/ZkclientZookeeperClient.java
@@ -1,8 +1,10 @@
package com.alibaba.dubbo.remoting.zookeeper.zkclient;
-import java.util.List;
-
import com.alibaba.dubbo.common.Constants;
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.remoting.zookeeper.ChildListener;
+import com.alibaba.dubbo.remoting.zookeeper.StateListener;
+import com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient;
import org.I0Itec.zkclient.IZkChildListener;
import org.I0Itec.zkclient.IZkStateListener;
import org.I0Itec.zkclient.ZkClient;
@@ -10,90 +12,95 @@
import org.I0Itec.zkclient.exception.ZkNodeExistsException;
import org.apache.zookeeper.Watcher.Event.KeeperState;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.remoting.zookeeper.ChildListener;
-import com.alibaba.dubbo.remoting.zookeeper.StateListener;
-import com.alibaba.dubbo.remoting.zookeeper.support.AbstractZookeeperClient;
+import java.util.List;
public class ZkclientZookeeperClient extends AbstractZookeeperClient {
- private final ZkClient client;
+ private final ZkClient client;
- private volatile KeeperState state = KeeperState.SyncConnected;
+ private volatile KeeperState state = KeeperState.SyncConnected;
- public ZkclientZookeeperClient(URL url) {
- super(url);
- client = new ZkClient(
+ public ZkclientZookeeperClient(URL url) {
+ super(url);
+ client = new ZkClient(
url.getBackupAddress(),
url.getParameter(Constants.SESSION_TIMEOUT_KEY, Constants.DEFAULT_SESSION_TIMEOUT),
url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_REGISTRY_CONNECT_TIMEOUT));
- client.subscribeStateChanges(new IZkStateListener() {
- public void handleStateChanged(KeeperState state) throws Exception {
- ZkclientZookeeperClient.this.state = state;
- if (state == KeeperState.Disconnected) {
- stateChanged(StateListener.DISCONNECTED);
- } else if (state == KeeperState.SyncConnected) {
- stateChanged(StateListener.CONNECTED);
- }
- }
- public void handleNewSession() throws Exception {
- stateChanged(StateListener.RECONNECTED);
- }
- });
- }
-
- public void createPersistent(String path) {
- try {
- client.createPersistent(path, true);
- } catch (ZkNodeExistsException e) {
- }
- }
-
- public void createEphemeral(String path) {
- try {
- client.createEphemeral(path);
- } catch (ZkNodeExistsException e) {
- }
- }
-
- public void delete(String path) {
- try {
- client.delete(path);
- } catch (ZkNoNodeException e) {
- }
- }
-
- public List getChildren(String path) {
- try {
- return client.getChildren(path);
+ client.subscribeStateChanges(new IZkStateListener() {
+ public void handleStateChanged(KeeperState state) throws Exception {
+ ZkclientZookeeperClient.this.state = state;
+ if (state == KeeperState.Disconnected) {
+ stateChanged(StateListener.DISCONNECTED);
+ } else if (state == KeeperState.SyncConnected) {
+ stateChanged(StateListener.CONNECTED);
+ }
+ }
+
+ public void handleNewSession() throws Exception {
+ stateChanged(StateListener.RECONNECTED);
+ }
+
+ //@Override
+ public void handleSessionEstablishmentError(Throwable error) throws Exception {
+ //TODO list...
+ logger.error("zookeeper connection error!", error);
+ throw new Exception(error);
+ }
+ });
+ }
+
+ public void createPersistent(String path) {
+ try {
+ client.createPersistent(path, true);
+ } catch (ZkNodeExistsException e) {
+ }
+ }
+
+ public void createEphemeral(String path) {
+ try {
+ client.createEphemeral(path);
+ } catch (ZkNodeExistsException e) {
+ }
+ }
+
+ public void delete(String path) {
+ try {
+ client.delete(path);
+ } catch (ZkNoNodeException e) {
+ }
+ }
+
+ public List getChildren(String path) {
+ try {
+ return client.getChildren(path);
} catch (ZkNoNodeException e) {
return null;
}
- }
-
- public boolean isConnected() {
- return state == KeeperState.SyncConnected;
- }
-
- public void doClose() {
- client.close();
- }
-
- public IZkChildListener createTargetChildListener(String path, final ChildListener listener) {
- return new IZkChildListener() {
- public void handleChildChange(String parentPath, List currentChilds)
- throws Exception {
- listener.childChanged(parentPath, currentChilds);
- }
- };
- }
-
- public List addTargetChildListener(String path, final IZkChildListener listener) {
- return client.subscribeChildChanges(path, listener);
- }
-
- public void removeTargetChildListener(String path, IZkChildListener listener) {
- client.unsubscribeChildChanges(path, listener);
- }
+ }
+
+ public boolean isConnected() {
+ return state == KeeperState.SyncConnected;
+ }
+
+ public void doClose() {
+ client.close();
+ }
+
+ public IZkChildListener createTargetChildListener(String path, final ChildListener listener) {
+ return new IZkChildListener() {
+ public void handleChildChange(String parentPath, List currentChilds)
+ throws Exception {
+ listener.childChanged(parentPath, currentChilds);
+ }
+ };
+ }
+
+ public List addTargetChildListener(String path, final IZkChildListener listener) {
+ return client.subscribeChildChanges(path, listener);
+ }
+
+ public void removeTargetChildListener(String path, IZkChildListener listener) {
+ client.unsubscribeChildChanges(path, listener);
+ }
}
diff --git a/dubbo-remoting/pom.xml b/dubbo-remoting/pom.xml
index 0c7faf42bbc..55d2313c6bc 100644
--- a/dubbo-remoting/pom.xml
+++ b/dubbo-remoting/pom.xml
@@ -18,7 +18,7 @@
com.alibaba
dubbo-parent
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-remoting
pom
diff --git a/dubbo-rpc/dubbo-rpc-api/pom.xml b/dubbo-rpc/dubbo-rpc-api/pom.xml
index e713642d38e..1aacb4f94d3 100644
--- a/dubbo-rpc/dubbo-rpc-api/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-api/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-api
jar
diff --git a/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/utils/ErrorCodeUtils.java b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/utils/ErrorCodeUtils.java
new file mode 100644
index 00000000000..edd6035f614
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-api/src/main/java/com/alibaba/dubbo/rpc/utils/ErrorCodeUtils.java
@@ -0,0 +1,25 @@
+package com.alibaba.dubbo.rpc.utils;
+
+import com.alibaba.dubbo.rpc.RpcException;
+
+import java.io.IOException;
+import java.net.SocketTimeoutException;
+
+/**
+ * Created by yangjunming on 2/24/16.
+ * author: yangjunming@huijiame.com
+ */
+public class ErrorCodeUtils {
+
+ public static int getErrorCode(Throwable e, Class> cls) {
+ // 是根据测试Case发现的问题,对RpcException.setCode进行设置
+ if (SocketTimeoutException.class.equals(cls)) {
+ return RpcException.TIMEOUT_EXCEPTION;
+ } else if (IOException.class.isAssignableFrom(cls)) {
+ return RpcException.NETWORK_EXCEPTION;
+ } else if (ClassNotFoundException.class.isAssignableFrom(cls)) {
+ return RpcException.SERIALIZATION_EXCEPTION;
+ }
+ return 0;
+ }
+}
diff --git a/dubbo-tool/dubbo-demo-lite-archetype/src/main/resources/archetype-resources/__rootArtifactId__-api/pom.xml b/dubbo-rpc/dubbo-rpc-avro/pom.xml
similarity index 57%
rename from dubbo-tool/dubbo-demo-lite-archetype/src/main/resources/archetype-resources/__rootArtifactId__-api/pom.xml
rename to dubbo-rpc/dubbo-rpc-avro/pom.xml
index 0e6f85553e4..0b1eb507cf3 100644
--- a/dubbo-tool/dubbo-demo-lite-archetype/src/main/resources/archetype-resources/__rootArtifactId__-api/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-avro/pom.xml
@@ -1,44 +1,47 @@
-
+-->
+
4.0.0
- ${groupId}
- ${rootArtifactId}
- ${version}
+ com.alibaba
+ dubbo-rpc
+ 2.8.5-SNAPSHOT
- ${artifactId}
+ dubbo-rpc-avro
jar
${project.artifactId}
- The demo module of dubbo project
+ The avro-rpc module of dubbo project
true
+
com.alibaba
- dubbo
+ dubbo-rpc-api
+ ${project.parent.version}
- javax.servlet
- javax.servlet-api
+ org.apache.avro
+ avro
- javax.validation
- validation-api
+ org.apache.avro
+ avro-ipc
-
+
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-avro/src/main/java/com/alibaba/dubbo/rpc/protocol/avro/AvroProtocol.java b/dubbo-rpc/dubbo-rpc-avro/src/main/java/com/alibaba/dubbo/rpc/protocol/avro/AvroProtocol.java
new file mode 100644
index 00000000000..4adabc44a74
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-avro/src/main/java/com/alibaba/dubbo/rpc/protocol/avro/AvroProtocol.java
@@ -0,0 +1,76 @@
+package com.alibaba.dubbo.rpc.protocol.avro;
+
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.common.logger.Logger;
+import com.alibaba.dubbo.common.logger.LoggerFactory;
+import com.alibaba.dubbo.rpc.RpcException;
+import com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol;
+import org.apache.avro.ipc.NettyServer;
+import org.apache.avro.ipc.NettyTransceiver;
+import org.apache.avro.ipc.Server;
+import org.apache.avro.ipc.reflect.ReflectRequestor;
+import org.apache.avro.ipc.reflect.ReflectResponder;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+
+/**
+ * 为dubbo-rpc添加avro支持
+ * by 杨俊明(http://yjmyzz.cnblogs.com/)
+ */
+public class AvroProtocol extends AbstractProxyProtocol {
+ public static final int DEFAULT_PORT = 40881;
+ private static final Logger logger = LoggerFactory.getLogger(AvroProtocol.class);
+
+ public AvroProtocol() {
+ super(IOException.class, RpcException.class);
+ }
+
+ public int getDefaultPort() {
+ return DEFAULT_PORT;
+ }
+
+ @Override
+ protected Runnable doExport(T impl, Class type, URL url)
+ throws RpcException {
+
+ logger.info("impl => " + impl.getClass());
+ logger.info("type => " + type.getName());
+ logger.info("url => " + url);
+
+ final Server server = new NettyServer(new ReflectResponder(type, impl),
+ new InetSocketAddress(url.getHost(), url.getPort()));
+ server.start();
+
+ logger.info("Start Avro Server");
+
+ return new Runnable() {
+ public void run() {
+ try {
+ logger.info("Close Avro Server");
+ server.close();
+ } catch (Throwable e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+ };
+ }
+
+ @Override
+ protected T doRefer(Class type, URL url) throws RpcException {
+
+ logger.info("type => " + type.getName());
+ logger.info("url => " + url);
+
+ try {
+ NettyTransceiver client = new NettyTransceiver(new InetSocketAddress(url.getHost(), url.getPort()));
+ T ref = ReflectRequestor.getClient(type, client);
+ logger.info("Create Avro Client");
+ return ref;
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RpcException("Fail to create remoting client for service(" + url + "): " + e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/dubbo-rpc/dubbo-rpc-avro/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.rpc.Protocol b/dubbo-rpc/dubbo-rpc-avro/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.rpc.Protocol
new file mode 100644
index 00000000000..eb16dd7df50
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-avro/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.rpc.Protocol
@@ -0,0 +1 @@
+avro=com.alibaba.dubbo.rpc.protocol.avro.AvroProtocol
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-default/pom.xml b/dubbo-rpc/dubbo-rpc-default/pom.xml
index a31250d37db..f8d8aa2739f 100644
--- a/dubbo-rpc/dubbo-rpc-default/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-default/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-default
jar
@@ -56,16 +56,16 @@
${project.parent.version}
test
-
- com.alibaba
- dubbo-remoting-mina
- ${project.parent.version}
- test
-
-
- org.apache.mina
- mina-core
- test
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-grpc/pom.xml b/dubbo-rpc/dubbo-rpc-grpc/pom.xml
new file mode 100644
index 00000000000..b88c2167274
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/pom.xml
@@ -0,0 +1,58 @@
+
+
+ 4.0.0
+
+ com.alibaba
+ dubbo-rpc
+ 2.8.5-SNAPSHOT
+
+ dubbo-rpc-grpc
+ jar
+ ${project.artifactId}
+ The grpc module of dubbo project
+
+ true
+
+
+
+
+ com.alibaba
+ dubbo-rpc-api
+ ${project.parent.version}
+
+
+
+
+ io.grpc
+ grpc-netty
+ 1.0.1
+
+
+ io.grpc
+ grpc-protobuf
+ 1.0.1
+
+
+ io.grpc
+ grpc-stub
+ 1.0.1
+
+
+
+
+
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/DefaultBindableService.java b/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/DefaultBindableService.java
new file mode 100644
index 00000000000..a722e87c8f2
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/DefaultBindableService.java
@@ -0,0 +1,27 @@
+package com.alibaba.dubbo.rpc.protocol.grpc;
+
+import io.grpc.Channel;
+import io.grpc.ServerServiceDefinition;
+
+/**
+ * Created by yangjunming on 16/10/7.
+ */
+public class DefaultBindableService implements GrpcBindableService {
+
+ private Channel channel;
+
+ @Override
+ public Channel getChannel() {
+ return channel;
+ }
+
+ @Override
+ public void setChannel(Channel channel) {
+ this.channel = channel;
+ }
+
+ @Override
+ public ServerServiceDefinition bindService() {
+ return null;
+ }
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/GrpcBindableService.java b/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/GrpcBindableService.java
new file mode 100644
index 00000000000..c1c57750c29
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/GrpcBindableService.java
@@ -0,0 +1,14 @@
+package com.alibaba.dubbo.rpc.protocol.grpc;
+
+import io.grpc.BindableService;
+import io.grpc.Channel;
+
+/**
+ * Created by yangjunming on 16/10/7.
+ */
+public interface GrpcBindableService extends BindableService {
+
+ Channel getChannel();
+
+ void setChannel(Channel channel);
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/GrpcProtocol.java b/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/GrpcProtocol.java
new file mode 100644
index 00000000000..85dc8a21dce
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/main/java/com/alibaba/dubbo/rpc/protocol/grpc/GrpcProtocol.java
@@ -0,0 +1,81 @@
+package com.alibaba.dubbo.rpc.protocol.grpc;
+
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.common.logger.Logger;
+import com.alibaba.dubbo.common.logger.LoggerFactory;
+import com.alibaba.dubbo.rpc.RpcException;
+import com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol;
+import io.grpc.ManagedChannel;
+import io.grpc.ManagedChannelBuilder;
+import io.grpc.Server;
+import io.grpc.ServerBuilder;
+
+import java.io.IOException;
+
+/**
+ * 为dubbo-rpc添加"google-gRPC"支持
+ * by 杨俊明(http://yjmyzz.cnblogs.com/)
+ */
+public class GrpcProtocol extends AbstractProxyProtocol {
+ public static final int DEFAULT_PORT = 50051;
+ private static final Logger logger = LoggerFactory.getLogger(GrpcProtocol.class);
+
+ public int getDefaultPort() {
+ return DEFAULT_PORT;
+ }
+
+ public GrpcProtocol() {
+ super(IOException.class, RpcException.class);
+ }
+
+ @Override
+ protected Runnable doExport(T impl, Class type, URL url)
+ throws RpcException {
+
+ logger.info("impl => " + impl.getClass());
+ logger.info("type => " + type.getName());
+ logger.info("url => " + url);
+
+ try {
+ String clsName = url.getParameter("class");
+ Class> cls = Class.forName(clsName);
+ GrpcBindableService service = (GrpcBindableService) cls.newInstance();
+ final Server grpcServer = ServerBuilder.forPort(url.getPort())
+ .addService(service)
+ .build()
+ .start();
+ logger.info("grpc server started !");
+ return new Runnable() {
+ public void run() {
+ try {
+ logger.info("Close gRPC Server");
+ grpcServer.shutdown();
+ } catch (Throwable e) {
+ logger.warn(e.getMessage(), e);
+ }
+ }
+ };
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RpcException(e.getMessage(), e);
+ }
+ }
+
+ @Override
+ protected T doRefer(Class type, URL url) throws RpcException {
+ logger.info("type => " + type.getName());
+ logger.info("url => " + url);
+ final ManagedChannel channel = ManagedChannelBuilder.forAddress(url.getHost(), url.getPort())
+ .usePlaintext(true)
+ .build();
+ try {
+ DefaultBindableService service = new DefaultBindableService();
+ service.setChannel(channel);
+ return (T) service;
+ } catch (Exception e) {
+ logger.error(e.getMessage(), e);
+ throw new RpcException(e.getMessage(), e);
+ }
+ }
+
+}
diff --git a/dubbo-rpc/dubbo-rpc-grpc/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.rpc.Protocol b/dubbo-rpc/dubbo-rpc-grpc/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.rpc.Protocol
new file mode 100644
index 00000000000..e09695d55ef
--- /dev/null
+++ b/dubbo-rpc/dubbo-rpc-grpc/src/main/resources/META-INF/dubbo/internal/com.alibaba.dubbo.rpc.Protocol
@@ -0,0 +1 @@
+grpc=com.alibaba.dubbo.rpc.protocol.grpc.GrpcProtocol
diff --git a/dubbo-rpc/dubbo-rpc-hessian/pom.xml b/dubbo-rpc/dubbo-rpc-hessian/pom.xml
index bf5e50cb4c6..c1b8394ac84 100644
--- a/dubbo-rpc/dubbo-rpc-hessian/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-hessian/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-hessian
jar
diff --git a/dubbo-rpc/dubbo-rpc-http/pom.xml b/dubbo-rpc/dubbo-rpc-http/pom.xml
index a2ad7c134f3..3687a9bd311 100644
--- a/dubbo-rpc/dubbo-rpc-http/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-http/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-http
jar
diff --git a/dubbo-rpc/dubbo-rpc-http/src/main/java/com/alibaba/dubbo/rpc/protocol/http/HttpProtocol.java b/dubbo-rpc/dubbo-rpc-http/src/main/java/com/alibaba/dubbo/rpc/protocol/http/HttpProtocol.java
index 84bc398a3fb..3b7c9504073 100644
--- a/dubbo-rpc/dubbo-rpc-http/src/main/java/com/alibaba/dubbo/rpc/protocol/http/HttpProtocol.java
+++ b/dubbo-rpc/dubbo-rpc-http/src/main/java/com/alibaba/dubbo/rpc/protocol/http/HttpProtocol.java
@@ -15,22 +15,6 @@
*/
package com.alibaba.dubbo.rpc.protocol.http;
-import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.SocketTimeoutException;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.springframework.remoting.RemoteAccessException;
-import org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor;
-import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
-import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;
-import org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor;
-
import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.URL;
import com.alibaba.dubbo.remoting.http.HttpBinder;
@@ -39,22 +23,39 @@
import com.alibaba.dubbo.rpc.RpcContext;
import com.alibaba.dubbo.rpc.RpcException;
import com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol;
+import com.alibaba.dubbo.rpc.utils.ErrorCodeUtils;
+import org.springframework.remoting.RemoteAccessException;
+import org.springframework.remoting.httpinvoker.HttpComponentsHttpInvokerRequestExecutor;
+import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean;
+import org.springframework.remoting.httpinvoker.HttpInvokerServiceExporter;
+import org.springframework.remoting.httpinvoker.SimpleHttpInvokerRequestExecutor;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+//import org.springframework.remoting.httpinvoker.CommonsHttpInvokerRequestExecutor;
+//http://forum.spring.io/forum/spring-projects/web/744585-commonshttpinvokerrequestexecutor-in-spring-4-0
/**
* HttpProtocol
- *
+ *
* @author william.liangf
*/
public class HttpProtocol extends AbstractProxyProtocol {
- public static final int DEFAULT_PORT = 80;
+ public static final int DEFAULT_PORT = 80;
private final Map serverMap = new ConcurrentHashMap();
private final Map skeletonMap = new ConcurrentHashMap();
private HttpBinder httpBinder;
-
+
public HttpProtocol() {
super(RemoteAccessException.class);
}
@@ -68,12 +69,12 @@ public int getDefaultPort() {
}
private class InternalHandler implements HttpHandler {
-
+
public void handle(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException {
String uri = request.getRequestURI();
HttpInvokerServiceExporter skeleton = skeletonMap.get(uri);
- if (! request.getMethod().equalsIgnoreCase("POST")) {
+ if (!request.getMethod().equalsIgnoreCase("POST")) {
response.setStatus(500);
} else {
RpcContext.getContext().setRemoteAddress(request.getRemoteAddr(), request.getRemotePort());
@@ -84,7 +85,7 @@ public void handle(HttpServletRequest request, HttpServletResponse response)
}
}
}
-
+
}
protected Runnable doExport(final T impl, Class type, URL url) throws RpcException {
@@ -118,21 +119,22 @@ protected T doRefer(final Class serviceType, final URL url) throws RpcExc
httpProxyFactoryBean.setServiceInterface(serviceType);
String client = url.getParameter(Constants.CLIENT_KEY);
if (client == null || client.length() == 0 || "simple".equals(client)) {
- SimpleHttpInvokerRequestExecutor httpInvokerRequestExecutor = new SimpleHttpInvokerRequestExecutor() {
- protected void prepareConnection(HttpURLConnection con,
- int contentLength) throws IOException {
- super.prepareConnection(con, contentLength);
- con.setReadTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
- con.setConnectTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
- }
- };
- httpProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
+ SimpleHttpInvokerRequestExecutor httpInvokerRequestExecutor = new SimpleHttpInvokerRequestExecutor() {
+ protected void prepareConnection(HttpURLConnection con,
+ int contentLength) throws IOException {
+ super.prepareConnection(con, contentLength);
+ con.setReadTimeout(url.getParameter(Constants.TIMEOUT_KEY, Constants.DEFAULT_TIMEOUT));
+ con.setConnectTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
+ }
+ };
+ httpProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
} else if ("commons".equals(client)) {
- CommonsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new CommonsHttpInvokerRequestExecutor();
- httpInvokerRequestExecutor.setReadTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
- httpProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
+ HttpComponentsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new HttpComponentsHttpInvokerRequestExecutor();
+ //CommonsHttpInvokerRequestExecutor httpInvokerRequestExecutor = new CommonsHttpInvokerRequestExecutor();
+ httpInvokerRequestExecutor.setReadTimeout(url.getParameter(Constants.CONNECT_TIMEOUT_KEY, Constants.DEFAULT_CONNECT_TIMEOUT));
+ httpProxyFactoryBean.setHttpInvokerRequestExecutor(httpInvokerRequestExecutor);
} else if (client != null && client.length() > 0) {
- throw new IllegalStateException("Unsupported http protocol client " + client + ", only supported: simple, commons");
+ throw new IllegalStateException("Unsupported http protocol client " + client + ", only supported: simple, commons");
}
httpProxyFactoryBean.afterPropertiesSet();
return (T) httpProxyFactoryBean.getObject();
@@ -144,16 +146,19 @@ protected int getErrorCode(Throwable e) {
}
if (e != null) {
Class> cls = e.getClass();
- // 是根据测试Case发现的问题,对RpcException.setCode进行设置
- if (SocketTimeoutException.class.equals(cls)) {
- return RpcException.TIMEOUT_EXCEPTION;
- } else if (IOException.class.isAssignableFrom(cls)) {
- return RpcException.NETWORK_EXCEPTION;
- } else if (ClassNotFoundException.class.isAssignableFrom(cls)) {
- return RpcException.SERIALIZATION_EXCEPTION;
- }
+// // 是根据测试Case发现的问题,对RpcException.setCode进行设置
+// if (SocketTimeoutException.class.equals(cls)) {
+// return RpcException.TIMEOUT_EXCEPTION;
+// } else if (IOException.class.isAssignableFrom(cls)) {
+// return RpcException.NETWORK_EXCEPTION;
+// } else if (ClassNotFoundException.class.isAssignableFrom(cls)) {
+// return RpcException.SERIALIZATION_EXCEPTION;
+// }
+ return ErrorCodeUtils.getErrorCode(e, cls);
+
}
return super.getErrorCode(e);
}
+
}
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-injvm/pom.xml b/dubbo-rpc/dubbo-rpc-injvm/pom.xml
index dcdda8d5345..d4f7a02a77a 100644
--- a/dubbo-rpc/dubbo-rpc-injvm/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-injvm/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-injvm
jar
diff --git a/dubbo-rpc/dubbo-rpc-memcached/pom.xml b/dubbo-rpc/dubbo-rpc-memcached/pom.xml
index 6a2af14c3c6..81878594349 100644
--- a/dubbo-rpc/dubbo-rpc-memcached/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-memcached/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-memcached
jar
diff --git a/dubbo-rpc/dubbo-rpc-redis/pom.xml b/dubbo-rpc/dubbo-rpc-redis/pom.xml
index 9e39b9fa31f..4fb7ad1000b 100644
--- a/dubbo-rpc/dubbo-rpc-redis/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-redis/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-redis
jar
diff --git a/dubbo-rpc/dubbo-rpc-rest/pom.xml b/dubbo-rpc/dubbo-rpc-rest/pom.xml
index 11edf84ca91..a470ea54957 100644
--- a/dubbo-rpc/dubbo-rpc-rest/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-rest/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-rest
jar
diff --git a/dubbo-rpc/dubbo-rpc-rmi/pom.xml b/dubbo-rpc/dubbo-rpc-rmi/pom.xml
index 84b76b9a059..d430231e558 100644
--- a/dubbo-rpc/dubbo-rpc-rmi/pom.xml
+++ b/dubbo-rpc/dubbo-rpc-rmi/pom.xml
@@ -19,7 +19,7 @@
com.alibaba
dubbo-rpc
- 2.8.4
+ 2.8.5-SNAPSHOT
dubbo-rpc-rmi
jar
diff --git a/dubbo-rpc/dubbo-rpc-rmi/src/main/java/com/alibaba/dubbo/rpc/protocol/rmi/RmiProtocol.java b/dubbo-rpc/dubbo-rpc-rmi/src/main/java/com/alibaba/dubbo/rpc/protocol/rmi/RmiProtocol.java
index 79c8a834172..ef83b9ad5fc 100644
--- a/dubbo-rpc/dubbo-rpc-rmi/src/main/java/com/alibaba/dubbo/rpc/protocol/rmi/RmiProtocol.java
+++ b/dubbo-rpc/dubbo-rpc-rmi/src/main/java/com/alibaba/dubbo/rpc/protocol/rmi/RmiProtocol.java
@@ -15,26 +15,24 @@
*/
package com.alibaba.dubbo.rpc.protocol.rmi;
-import java.io.IOException;
-import java.net.SocketTimeoutException;
-import java.rmi.RemoteException;
-
+import com.alibaba.dubbo.common.URL;
+import com.alibaba.dubbo.rpc.RpcException;
+import com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol;
+import com.alibaba.dubbo.rpc.utils.ErrorCodeUtils;
import org.springframework.remoting.RemoteAccessException;
import org.springframework.remoting.rmi.RmiProxyFactoryBean;
import org.springframework.remoting.rmi.RmiServiceExporter;
-import com.alibaba.dubbo.common.URL;
-import com.alibaba.dubbo.rpc.RpcException;
-import com.alibaba.dubbo.rpc.protocol.AbstractProxyProtocol;
+import java.rmi.RemoteException;
/**
* RmiProtocol.
- *
+ *
* @author qian.lei
*/
public class RmiProtocol extends AbstractProxyProtocol {
- public static final int DEFAULT_PORT = 1099;
+ public static final int DEFAULT_PORT = 1099;
public RmiProtocol() {
super(RemoteAccessException.class, RemoteException.class);
@@ -84,14 +82,15 @@ protected int getErrorCode(Throwable e) {
}
if (e != null && e.getCause() != null) {
Class> cls = e.getCause().getClass();
- // 是根据测试Case发现的问题,对RpcException.setCode进行设置
- if (SocketTimeoutException.class.equals(cls)) {
- return RpcException.TIMEOUT_EXCEPTION;
- } else if (IOException.class.isAssignableFrom(cls)) {
- return RpcException.NETWORK_EXCEPTION;
- } else if (ClassNotFoundException.class.isAssignableFrom(cls)) {
- return RpcException.SERIALIZATION_EXCEPTION;
- }
+// // 是根据测试Case发现的问题,对RpcException.setCode进行设置
+// if (SocketTimeoutException.class.equals(cls)) {
+// return RpcException.TIMEOUT_EXCEPTION;
+// } else if (IOException.class.isAssignableFrom(cls)) {
+// return RpcException.NETWORK_EXCEPTION;
+// } else if (ClassNotFoundException.class.isAssignableFrom(cls)) {
+// return RpcException.SERIALIZATION_EXCEPTION;
+// }
+ return ErrorCodeUtils.getErrorCode(e, cls);
}
return super.getErrorCode(e);
}
diff --git a/dubbo-rpc/dubbo-rpc-thrift/pom.xml b/dubbo-rpc/dubbo-rpc-thrift/pom.xml
deleted file mode 100644
index 4b5d5d075ec..00000000000
--- a/dubbo-rpc/dubbo-rpc-thrift/pom.xml
+++ /dev/null
@@ -1,79 +0,0 @@
-
-
- 4.0.0
-
- com.alibaba
- dubbo-rpc
- 2.8.4
-
- dubbo-rpc-thrift
- jar
- ${project.artifactId}
- The thrift rpc module of dubbo project
-
- true
-
-
-
- com.alibaba
- dubbo-rpc-api
- ${project.parent.version}
-
-
- com.alibaba
- dubbo-rpc-default
- ${project.parent.version}
-
-
- com.alibaba
- dubbo-remoting-api
- ${project.parent.version}
-
-
- com.alibaba
- dubbo-remoting-netty
- ${project.parent.version}
-
-
- org.apache.thrift
- libthrift
-
-
- org.apache.httpcomponents
- httpcore
-
-
-
-
- org.apache.httpcomponents
- httpclient
-
-
- com.alibaba
- dubbo-config-spring
- ${project.parent.version}
- test
-
-
- com.alibaba
- dubbo-registry-multicast
- ${project.parent.version}
- test
-
-
-
\ No newline at end of file
diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ClassNameGenerator.java b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ClassNameGenerator.java
deleted file mode 100644
index 36e5eda2821..00000000000
--- a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ClassNameGenerator.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * File Created at 2012-02-02
- * $Id$
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.rpc.protocol.thrift;
-
-import com.alibaba.dubbo.common.extension.SPI;
-
-/**
- * @author kimi
- */
-@SPI( DubboClassNameGenerator.NAME )
-public interface ClassNameGenerator {
-
- public String generateArgsClassName( String serviceName, String methodName );
-
- public String generateResultClassName( String serviceName, String methodName );
-
-}
diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/DubboClassNameGenerator.java b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/DubboClassNameGenerator.java
deleted file mode 100644
index ab9d70832bc..00000000000
--- a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/DubboClassNameGenerator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * File Created at 2012-02-02
- * $Id$
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.rpc.protocol.thrift;
-
-/**
- * @author kimi
- */
-public class DubboClassNameGenerator implements ClassNameGenerator {
-
- public static final String NAME = "dubbo";
-
- public String generateArgsClassName( String serviceName, String methodName ) {
- return ThriftUtils.generateMethodArgsClassName( serviceName, methodName );
- }
-
- public String generateResultClassName( String serviceName, String methodName ) {
- return ThriftUtils.generateMethodResultClassName( serviceName, methodName );
- }
-
-}
diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftClassNameGenerator.java b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftClassNameGenerator.java
deleted file mode 100644
index 5c34c222f25..00000000000
--- a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftClassNameGenerator.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * File Created at 2012-02-02
- * $Id$
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.rpc.protocol.thrift;
-
-/**
- * @author kimi
- */
-public class ThriftClassNameGenerator implements ClassNameGenerator {
-
- public static final String NAME = "thrift";
-
- public String generateArgsClassName( String serviceName, String methodName ) {
- return ThriftUtils.generateMethodArgsClassNameThrift( serviceName, methodName );
- }
-
- public String generateResultClassName( String serviceName, String methodName ) {
- return ThriftUtils.generateMethodResultClassNameThrift( serviceName, methodName );
- }
-
-}
diff --git a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftCodec.java b/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftCodec.java
deleted file mode 100644
index 6c4dee9837f..00000000000
--- a/dubbo-rpc/dubbo-rpc-thrift/src/main/java/com/alibaba/dubbo/rpc/protocol/thrift/ThriftCodec.java
+++ /dev/null
@@ -1,719 +0,0 @@
-/**
- * File Created at 2011-12-05
- * $Id$
- *
- * Copyright 2008 Alibaba.com Croporation Limited.
- * All rights reserved.
- *
- * This software is the confidential and proprietary information of
- * Alibaba Company. ("Confidential Information"). You shall not
- * disclose such Confidential Information and shall use it only in
- * accordance with the terms of the license agreement you entered into
- * with Alibaba.com.
- */
-package com.alibaba.dubbo.rpc.protocol.thrift;
-
-
-import java.io.IOException;
-import java.lang.reflect.Field;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.thrift.TApplicationException;
-import org.apache.thrift.TBase;
-import org.apache.thrift.TException;
-import org.apache.thrift.TFieldIdEnum;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TMessage;
-import org.apache.thrift.protocol.TMessageType;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.TFramedTransport;
-import org.apache.thrift.transport.TIOStreamTransport;
-
-import com.alibaba.dubbo.common.Constants;
-import com.alibaba.dubbo.common.extension.ExtensionLoader;
-import com.alibaba.dubbo.common.utils.ClassHelper;
-import com.alibaba.dubbo.remoting.Channel;
-import com.alibaba.dubbo.remoting.Codec2;
-import com.alibaba.dubbo.remoting.buffer.ChannelBuffer;
-import com.alibaba.dubbo.remoting.buffer.ChannelBufferInputStream;
-import com.alibaba.dubbo.remoting.exchange.Request;
-import com.alibaba.dubbo.remoting.exchange.Response;
-import com.alibaba.dubbo.rpc.RpcException;
-import com.alibaba.dubbo.rpc.RpcInvocation;
-import com.alibaba.dubbo.rpc.RpcResult;
-import com.alibaba.dubbo.rpc.protocol.thrift.io.RandomAccessByteArrayOutputStream;
-
-/**
- * Thrift framed protocol codec.
- *
- *
- * |<- message header ->|<- message body ->|
- * +----------------+----------------------+------------------+---------------------------+------------------+
- * | magic (2 bytes)|message size (4 bytes)|head size(2 bytes)| version (1 byte) | header | message body |
- * +----------------+----------------------+------------------+---------------------------+------------------+
- * |<- message size ->|
- *
- *
- *
- * header fields in version 1
- *
- * - string - service name
- * - long - dubbo request id
- *
- *
- *
- * @author gang.lvg
- */
-public class ThriftCodec implements Codec2 {
-
- private static final AtomicInteger THRIFT_SEQ_ID = new AtomicInteger( 0 );
-
- private static final ConcurrentMap> cachedClass =
- new ConcurrentHashMap>();
-
- static final ConcurrentMap cachedRequest =
- new ConcurrentHashMap();
-
- public static final int MESSAGE_LENGTH_INDEX = 2;
-
- public static final int MESSAGE_HEADER_LENGTH_INDEX = 6;
-
- public static final int MESSAGE_SHORTEST_LENGTH = 10;
-
- public static final String NAME = "thrift";
-
- public static final String PARAMETER_CLASS_NAME_GENERATOR = "class.name.generator";
-
- public static final byte VERSION = (byte)1;
-
- public static final short MAGIC = (short) 0xdabc;
-
- public void encode( Channel channel, ChannelBuffer buffer, Object message )
- throws IOException {
-
- if ( message instanceof Request ) {
- encodeRequest( channel, buffer, ( Request ) message );
- }
- else if ( message instanceof Response ) {
- encodeResponse( channel, buffer, ( Response ) message );
- } else {
- throw new UnsupportedOperationException(
- new StringBuilder( 32 )
- .append( "Thrift codec only support encode " )
- .append( Request.class.getName() )
- .append( " and " )
- .append( Response.class.getName() )
- .toString() );
- }
-
- }
-
- public Object decode( Channel channel, ChannelBuffer buffer ) throws IOException {
-
- int available = buffer.readableBytes();
-
- if ( available < MESSAGE_SHORTEST_LENGTH ) {
-
- return DecodeResult.NEED_MORE_INPUT;
-
- } else {
-
- TIOStreamTransport transport = new TIOStreamTransport( new ChannelBufferInputStream(buffer));
-
- TBinaryProtocol protocol = new TBinaryProtocol( transport );
-
- short magic;
- int messageLength;
-
- try{
-// protocol.readI32(); // skip the first message length
- byte[] bytes = new byte[4];
- transport.read( bytes, 0, 4 );
- magic = protocol.readI16();
- messageLength = protocol.readI32();
-
- } catch ( TException e ) {
- throw new IOException( e.getMessage(), e );
- }
-
- if ( MAGIC != magic ) {
- throw new IOException(
- new StringBuilder( 32 )
- .append( "Unknown magic code " )
- .append( magic )
- .toString() );
- }
-
- if ( available < messageLength ) { return DecodeResult.NEED_MORE_INPUT; }
-
- return decode( protocol );
-
- }
-
- }
-
- private Object decode( TProtocol protocol )
- throws IOException {
-
- // version
- String serviceName;
- long id;
-
- TMessage message;
-
- try {
- protocol.readI16();
- protocol.readByte();
- serviceName = protocol.readString();
- id = protocol.readI64();
- message = protocol.readMessageBegin();
- } catch ( TException e ) {
- throw new IOException( e.getMessage(), e );
- }
-
- if ( message.type == TMessageType.CALL ) {
-
- RpcInvocation result = new RpcInvocation();
- result.setAttachment(Constants.INTERFACE_KEY, serviceName );
- result.setMethodName( message.name );
-
- String argsClassName = ExtensionLoader.getExtensionLoader(ClassNameGenerator.class)
- .getExtension(ThriftClassNameGenerator.NAME).generateArgsClassName( serviceName, message.name );
-
- if ( StringUtils.isEmpty( argsClassName ) ) {
- throw new RpcException( RpcException.SERIALIZATION_EXCEPTION,
- "The specified interface name incorrect." );
- }
-
- Class clazz = cachedClass.get( argsClassName );
-
- if ( clazz == null ) {
- try {
-
- clazz = ClassHelper.forNameWithThreadContextClassLoader( argsClassName );
-
- cachedClass.putIfAbsent( argsClassName, clazz );
-
- } catch ( ClassNotFoundException e ) {
- throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
- }
- }
-
- TBase args;
-
- try {
- args = ( TBase ) clazz.newInstance();
- } catch ( InstantiationException e ) {
- throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
- } catch ( IllegalAccessException e ) {
- throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
- }
-
- try{
- args.read( protocol );
- protocol.readMessageEnd();
- } catch ( TException e ) {
- throw new RpcException( RpcException.SERIALIZATION_EXCEPTION, e.getMessage(), e );
- }
-
- List