Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1 #405

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open

1 #405

Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
cfd611d
update spring to 4.x and add log4j2 support
Feb 24, 2016
5dd65e3
update FST to lastest version
Feb 25, 2016
3a61a8b
recover dubbo-admin to spring 3.x
Feb 29, 2016
be9b679
change zkclient version to 0.8.1
Feb 29, 2016
688436d
add primitive thrift and hadoop avro support
Mar 6, 2016
5c1a977
add primitive thrift and hadoop avro support
Mar 6, 2016
fa615fb
add primitive thrift and hadoop avro support
Mar 6, 2016
711c6fa
add primitive thrift and hadoop avro support
Mar 6, 2016
d436cab
fix dubbo-admin compile error
Mar 6, 2016
d43e86b
update comment
Mar 6, 2016
67b84c5
update cxf to 3.0.5 (warning: maybe exists bug!)
Mar 24, 2016
8dd6c42
fix dubbo-admin cannot run in spring lastest version
Apr 3, 2016
e049153
bugfix fix hibernate-validator and make zkclient-0.8.1 to zkclient-0.…
xydonne Jun 15, 2016
1bf93b8
Merge pull request #1 from xydonne/yjmyzz-dubbox
yjmyzz Jun 17, 2016
b4f10ab
thrift balance
Aug 25, 2016
00c39d5
fix avro load balance bug
Sep 5, 2016
8404249
fix avro-protocal load balance bug
Sep 5, 2016
53ff79d
add upload-to-nexus config sample
yjmyzz Sep 5, 2016
8535e8d
update zkclient to 0.9
Sep 18, 2016
d0c8a93
update zkclient to 0.9
Sep 18, 2016
9cafeda
grpc
Oct 6, 2016
878b8af
增加grpc的支持
Oct 8, 2016
f2752cc
modify readme
Oct 8, 2016
02bbf68
change readme
Oct 8, 2016
d1a8f0b
change readme
Oct 8, 2016
6f7a94d
grpc
Nov 2, 2016
9238a83
add rpc-grpc protocal
Nov 15, 2016
d8ae6e0
增加grpc 1.0的支持,重写dubbo-demo模块,提供了rest/dubbo/avro/thrift/grpc五种协议的基本示例
Dec 25, 2016
6883598
增加了google-gRPC-1.0.1的支持,重写了dubbo-demo模块,提供了rest/dubbo/avro/thrift/grp…
Dec 25, 2016
31867f4
小修改
Dec 25, 2016
488a1c4
small change
Dec 25, 2016
df60318
版本调整
Dec 25, 2016
07d356e
upload
Dec 25, 2016
93196b0
解决thrift server端并发连接数默认上限50的问题
Mar 11, 2017
8cae323
增加thrift连接超时
Mar 12, 2017
e3ceeab
modify backlog
Mar 12, 2017
83b36bb
路由规则匹配
raoshaoquan Mar 16, 2017
d64e855
thrift TThreadedSelectorServer 服务器
raoshaoquan Mar 16, 2017
2e9f0e4
thrift调整成TThreadedSelectorServer模式
Mar 17, 2017
cf7b207
Merge branch 'master' of https://github.com/yjmyzz/dubbox
Mar 17, 2017
241dcf2
thrift调整成TThreadedSelectorServer模式
Mar 17, 2017
b9e9256
微调
Mar 18, 2017
ab2fc4d
1、升级spring到最新的4.3.7-RELEASE
Mar 18, 2017
e6cad3b
删除默认 MonitorFilter
raoshaoquan Mar 21, 2017
5e58c1c
rest rpc 增加fastjson-provider的支持
Apr 24, 2017
b38180d
ContentType增加GBK编码常量
May 10, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add primitive thrift and hadoop avro support
  • Loading branch information
yangjunming committed Mar 6, 2016
commit 5c1a97743cbf825a74aa39d06c28619d728879b9
47 changes: 47 additions & 0 deletions dubbo-rpc/dubbo-rpc-avro/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<!--
- 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alibaba</groupId>
<artifactId>dubbo-rpc</artifactId>
<version>2.8.4a</version>
</parent>
<artifactId>dubbo-rpc-avro</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>The avro-rpc module of dubbo project</description>
<properties>
<skip_maven_deploy>true</skip_maven_deploy>

</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo-rpc-api</artifactId>
<version>${project.parent.version}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-ipc</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
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.net.InetSocketAddress;

/**
* 为dubbo-rpc添加"原生thrift"支持
* 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 int getDefaultPort() {
return DEFAULT_PORT;
}

@Override
protected <T> Runnable doExport(T impl, Class<T> 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();

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> T doRefer(Class<T> 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);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
avro=com.alibaba.dubbo.rpc.protocol.avro.AvroProtocol
51 changes: 51 additions & 0 deletions dubbo-rpc/dubbo-rpc-thrift2/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
- 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.alibaba</groupId>
<artifactId>dubbo-rpc</artifactId>
<version>2.8.4a</version>
</parent>
<artifactId>dubbo-rpc-thrift2</artifactId>
<packaging>jar</packaging>
<name>${project.artifactId}</name>
<description>The avro-rpc module of dubbo project</description>
<properties>
<skip_maven_deploy>true</skip_maven_deploy>

</properties>
<dependencies>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>dubbo-rpc-api</artifactId>
<version>${project.parent.version}</version>
</dependency>

<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>0.9.3</version>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
package com.alibaba.dubbo.rpc.protocol.thrift2;

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.thrift.TProcessor;
import org.apache.thrift.protocol.TCompactProtocol;
import org.apache.thrift.protocol.TProtocol;
import org.apache.thrift.server.TNonblockingServer;
import org.apache.thrift.server.TServer;
import org.apache.thrift.transport.TFramedTransport;
import org.apache.thrift.transport.TNonblockingServerSocket;
import org.apache.thrift.transport.TSocket;
import org.apache.thrift.transport.TTransport;

import java.lang.reflect.Constructor;

/**
* 为dubbo-rpc添加"原生thrift"支持
* by 杨俊明(http://yjmyzz.cnblogs.com/)
*/
public class Thrift2Protocol extends AbstractProxyProtocol {
public static final int DEFAULT_PORT = 33208;
private static final Logger logger = LoggerFactory.getLogger(Thrift2Protocol.class);

public int getDefaultPort() {
return DEFAULT_PORT;
}

@Override
protected <T> Runnable doExport(T impl, Class<T> type, URL url)
throws RpcException {

logger.info("impl => " + impl.getClass());
logger.info("type => " + type.getName());
logger.info("url => " + url);

TProcessor tprocessor;
TNonblockingServer.Args tArgs = null;
String iFace = "$Iface";
String processor = "$Processor";
String typeName = type.getName();
TNonblockingServerSocket transport;
if (typeName.endsWith(iFace)) {
String processorClsName = typeName.substring(0, typeName.indexOf(iFace)) + processor;
try {
Class<?> clazz = Class.forName(processorClsName);
Constructor constructor = clazz.getConstructor(type);
try {
tprocessor = (TProcessor) constructor.newInstance(impl);
transport = new TNonblockingServerSocket(url.getPort());
tArgs = new TNonblockingServer.Args(transport);
tArgs.processor(tprocessor);
tArgs.transportFactory(new TFramedTransport.Factory());
tArgs.protocolFactory(new TCompactProtocol.Factory());
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RpcException("Fail to create thrift server(" + url + ") : " + e.getMessage(), e);
}
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RpcException("Fail to create thrift server(" + url + ") : " + e.getMessage(), e);
}
}

if (tArgs == null) {
logger.error("Fail to create thrift server(" + url + ") due to null args");
throw new RpcException("Fail to create thrift server(" + url + ") due to null args");
}
final TServer thriftServer = new TNonblockingServer(tArgs);

new Thread(new Runnable() {
public void run() {
logger.info("Start Thrift Server");
thriftServer.serve();
logger.info("Thrift server started.");
}
}).start();

return new Runnable() {
public void run() {
try {
logger.info("Close Thrift Server");
thriftServer.stop();
} catch (Throwable e) {
logger.warn(e.getMessage(), e);
}
}
};
}

@Override
protected <T> T doRefer(Class<T> type, URL url) throws RpcException {

logger.info("type => " + type.getName());
logger.info("url => " + url);

try {
TSocket tSocket;
TTransport transport;
TProtocol protocol;
T thriftClient = null;
String iFace = "$Iface";
String client = "$Client";

String typeName = type.getName();
if (typeName.endsWith(iFace)) {
String clientClsName = typeName.substring(0, typeName.indexOf(iFace)) + client;
Class<?> clazz = Class.forName(clientClsName);
Constructor constructor = clazz.getConstructor(TProtocol.class);
try {
tSocket = new TSocket(url.getHost(), url.getPort());
transport = new TFramedTransport(tSocket);
protocol = new TCompactProtocol(transport);
thriftClient = (T) constructor.newInstance(protocol);
transport.open();
logger.info("thrift client opened for service(" + url + ")");
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RpcException("Fail to create remoting client:" + e.getMessage(), e);
}
}
return thriftClient;
} catch (Exception e) {
logger.error(e.getMessage(), e);
throw new RpcException("Fail to create remoting client for service(" + url + "): " + e.getMessage(), e);
}
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
thrift2=com.alibaba.dubbo.rpc.protocol.thrift2.Thrift2Protocol
4 changes: 3 additions & 1 deletion dubbo-rpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,17 @@
</properties>
<modules>
<module>dubbo-rpc-api</module>
<module>dubbo-rpc-avro</module>
<module>dubbo-rpc-default</module>
<module>dubbo-rpc-injvm</module>
<module>dubbo-rpc-rmi</module>
<module>dubbo-rpc-hessian</module>
<module>dubbo-rpc-http</module>
<module>dubbo-rpc-webservice</module>
<module>dubbo-rpc-thrift</module>
<module>dubbo-rpc-thrift2</module>
<module>dubbo-rpc-memcached</module>
<module>dubbo-rpc-redis</module>
<module>dubbo-rpc-rest</module>
<module>dubbo-rpc-rest</module>
</modules>
</project>
13 changes: 13 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@
<xmemcached_version>1.3.6</xmemcached_version>
<cxf_version>2.6.1</cxf_version>
<thrift_version>0.8.0</thrift_version>
<thrift2_version>0.9.3</thrift2_version>
<avro_version>1.8.0</avro_version>
<jfreechart_version>1.0.13</jfreechart_version>
<hessian_version>4.0.7</hessian_version>
<servlet_version>3.1.0</servlet_version>
Expand Down Expand Up @@ -185,6 +187,7 @@

<maven-surefire-plugin_version>2.17</maven-surefire-plugin_version>
<maven-jetty-plugin_version>8.1.15.v20140411</maven-jetty-plugin_version>
<avro_maven_plugin_version>1.8.0</avro_maven_plugin_version>

</properties>
<dependencyManagement>
Expand Down Expand Up @@ -296,6 +299,16 @@
<artifactId>libthrift</artifactId>
<version>${thrift_version}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro</artifactId>
<version>${avro_version}</version>
</dependency>
<dependency>
<groupId>org.apache.avro</groupId>
<artifactId>avro-ipc</artifactId>
<version>${avro_version}</version>
</dependency>
<dependency>
<groupId>jfree</groupId>
<artifactId>jfreechart</artifactId>
Expand Down