Coder Social home page Coder Social logo

weibocom / motan Goto Github PK

View Code? Open in Web Editor NEW
5.9K 5.9K 1.8K 4.25 MB

A cross-language remote procedure call(RPC) framework for rapid development of high performance distributed services.

License: Other

Java 89.15% JavaScript 5.81% CSS 3.25% HTML 1.65% Shell 0.15%

motan's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

motan's Issues

motan统计日志问题?

配置了 accessLog 属性,client 端调用了1000次接口,server端serverserviceStatsLog.log日志是: [motan-totalAccessStatistic] app: motan module: motan total_count: 0 slow_count: 0 biz_excp: 0 other_excp: 0 avg_time: 0.00ms biz_time: 0.00ms avg_tps: 0,为何server,client端的total_count一直是0呢?BUG?

com.weibo.api.motan.config.handler.SimpleConfigHandler.register Exception!

Hello,
我在本地Eclipse上运行没有问题,打成架包以后放到linux服务器上运行就报如下错误?是什么问题?
Exception in thread "main" java.lang.NullPointerException
at com.weibo.api.motan.config.handler.SimpleConfigHandler.register(SimpleConfigHandler.java:102)
at com.weibo.api.motan.config.handler.SimpleConfigHandler.export(SimpleConfigHandler.java:77)
at com.weibo.api.motan.config.ServiceConfig.doExport(ServiceConfig.java:211)
at com.weibo.api.motan.config.ServiceConfig.export(ServiceConfig.java:129)
at com.weibo.api.motan.config.springsupport.ServiceConfigBean.onApplicationEvent(ServiceConfigBean.java:90)
at com.weibo.api.motan.config.springsupport.ServiceConfigBean.onApplicationEvent(ServiceConfigBean.java:42)
at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:98)
at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:333)
at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:776)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:485)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)

motan client没有使用shutdownhook

版本0.1.0,motan client本身似乎没有使用shutdownhook,在强制关闭client的时候,server会报异常,如下,

09:35:05.232 ERROR [New I/O server worker #1-2] error NettyChannelHandler exceptionCaught: remote=arnes-PC/192.168.232.154:56910 local=/192.168.232.154:38001 event=java.io.IOException: 远程主机强迫关闭了一个现有的连接。
java.io.IOException: 远程主机强迫关闭了一个现有的连接。
at sun.nio.ch.SocketDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:192)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
at org.jboss.netty.channel.socket.nio.NioWorker.read(NioWorker.java:321)
at org.jboss.netty.channel.socket.nio.NioWorker.processSelectedKeys(NioWorker.java:280)
at org.jboss.netty.channel.socket.nio.NioWorker.run(NioWorker.java:200)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)

motan是否有预期增加shutdownhook?或者,我可以如何添加?

现在的版本能用于生产环境吗?

感觉相比dubbo更轻量,这点我很喜欢。正好有新项目要上,

  1. 能否在生产环境中使用?
  2. 有无交流的QQ群或微信群?
  3. 有无事件流的机制?
  4. 有无rxjava\event sourcing\lmax disruptor 等扩展或计划?

NettyClient 超时判断

刚开始研究motan第二天,提得比较鸡肋的地方请多包涵,能力不够没好意思提pull request。

NettyClient中使用了一个定时器线程扫描所有的异步请求是否超时,可否改用时间轮算法注册回调函数的办法判断超时?修改如下:

- timeMonitorFuture = scheduledExecutor.scheduleWithFixedDelay(
-               new TimeoutMonitor("timeout_monitor_" + url.getHost() + "_" + url.getPort()),
-               MotanConstants.NETTY_TIMEOUT_TIMER_PERIOD, -MotanConstants.NETTY_TIMEOUT_TIMER_PERIOD,
-               TimeUnit.MILLISECONDS);
+ timeWheel = new TimeWheel();
+ timeWheel.begin();

//关闭client
public synchronized void close(int timeout) {
  ...
- timeMonitorFuture.cancel(true);
+ timeWheel.stop();
  ...
}

public void registerCallback(final long requestId, final NettyResponseFuture nettyResponseFuture) {
...

    this.callbackMap.put(requestId, nettyResponseFuture);
//这里添加超时回调函数
        timeWheel.add(nettyResponseFuture.getTimeout(), new TimeWheel.ExpiringHandler() {
            @Override
            public void onExpire() {
                callbackMap.remove(requestId);
                nettyResponseFuture.cancel();
            }
        });
}
//Hash时间轮:
public class TimeWheel implements Runnable {

    private int timePointer;

    private int maxTTL;

    private int tickDuration;

    private AtomicBoolean stop = new AtomicBoolean(false);

    private ConcurrentHashMap<Integer, Set<ExpiringHandler>> wheel = new ConcurrentHashMap<Integer, Set<ExpiringHandler>>();

    public TimeWheel(int tickDuration, int maxTTL) {
        this.tickDuration = tickDuration;
        this.maxTTL = maxTTL;
    }

    public TimeWheel() {
        this(100, 60 * 60 * 1000);
    }

    public void begin() {
        Executors.newSingleThreadExecutor().execute(this);
    }

    public void add(int ttl, ExpiringHandler handler) {
        if (ttl >= maxTTL)
            throw new MotanFrameworkException("Timeout cannot be more than maxTTL.");
        if(ttl / tickDuration <= 0)
            throw new MotanFrameworkException("Too small ttl.");
        int position = (timePointer + ttl / tickDuration * tickDuration) % maxTTL;
        wheel.putIfAbsent(position, new ConcurrentHashSet<ExpiringHandler>());
        wheel.get(position).add(handler);
    }

    public void stop() {
        stop.getAndSet(true);
    }

    @Override
    public void run() {
        while (!stop.get()) {
            long c0 = System.currentTimeMillis();
            Set<ExpiringHandler> handlers = wheel.remove(timePointer);
            if (handlers != null) {
                for (ExpiringHandler handler : handlers)
                    handler.onExpire();
            }
            if (timePointer + tickDuration > maxTTL)
                timePointer = timePointer + tickDuration - maxTTL;
            else
                timePointer += tickDuration;
            long offset = System.currentTimeMillis() - c0;
            if (offset > tickDuration)
                continue;
            try {
                Thread.sleep(tickDuration - offset);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }

    public interface ExpiringHandler {

        void onExpire();
    }

}


看NettyChannelHandler时的疑问

我看NettyChannelHandler中有一个processResponse的方法,但是没有找到有处理Response消息的MessageHandler,是没有还是我没找到呢?

motan似乎与spring-boot不兼容

在使用spring-boot运行motan-demo的时候,server的服务无法注册到zookeeper,如下

[zk: localhost:2181(CONNECTED) 27] ls /motan/motan-demo-rpc/com.weibo.motan.demo
.service.MotanDemoService/server
[]

DemoRpcServer的代码改动如下,

package com.weibo.motan.demo.server;

import com.weibo.api.motan.common.MotanConstants;
import com.weibo.api.motan.util.MotanSwitcherUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import java.util.HashSet;
import java.util.Set;

@SpringBootApplication
public class DemoRpcServer {

    public static void main(String[] args) throws InterruptedException {
        SpringApplication app = new SpringApplication(DemoRpcServer.class);
        Set<Object> set = new HashSet<Object>();
        set.add("classpath*:motan_demo_server.xml");
        app.setSources(set);
        MotanSwitcherUtil.setSwitcherValue(MotanConstants.REGISTRY_HEARTBEAT_SWITCHER, true);
        app.run(args);
    }

}

pom.xml改动如下,

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.3.3.RELEASE</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <version>1.3.3.RELEASE</version>
        </dependency>

motan-demo其他代码基本未改动。还是哪里我可能弄错了?不确定这是不是一个问题

关于zookeeper数据结构的优化?

按照motan的zookeeper-registry设计:
将一个服务的所有params作为value放在ip节点里(key=ip+port,value=params),这样一次客户端更新会伴随着N+1次zk交互。在大规模部署下,一个核心服务的发版可能会有大量的zk交互流量。预估重启一台Server,所有Client与zk的交互次数=Client数量 * 依赖的Server接口数量 * 当前server数量。比如600台Client_10个接口_40台Server,就是24万次。
当这40台Server完成一轮发布,总共就是24万*40台=960万次。是笔不小的开销。

是否能这样设计:
server在写入params时,对params计算一个hash值,将hash放到key上(ip+port+hash)
当服务变更时,Client的流程:
1.先拉下来servers的所有子节点
2.判断本地缓存是否存在对应的hash,是则直接使用,否则才去取value里的params,并缓存。
这样,除开Client第一次重启,基本可以去掉N+1查询的N。

(dubbo的zk实现是将ip+port+params都作为key,key会很大。这样一次服务变更也会涉及大量冗余数据的传输,也会有问题)

感觉和dubbo差不多啊

首先非常感谢motan开源,顺便请问一下,看了下demo代码,感觉和dubbo差不多,请问motan和dubbo相比有什么优势?

消费者(客户端)请求服务器,出现:error_message: NettyResponseFuture task cancel 错误,实际上是客户端请求服务是成功的

12:20:00.989 [main] INFO info - NettyClient finish Open: url=motan://172.13.80.68:8002/com.zdmoney.assets.api.motan.FooService?group=default_rpc
12:20:00.992 [main] INFO info - DefaultRpcReferer node init Success: [DefaultRpcReferer] url=motan://172.13.80.68:8002/com.zdmoney.assets.api.motan.FooService?group=default_rpc
12:20:00.992 [main] INFO info - DefaultRpcProtocol refer Success: url=motan://172.13.80.68:8002/com.zdmoney.assets.api.motan.FooService?group=default_rpc
Exception in thread "main" com.weibo.api.motan.exception.MotanServiceException: error_message: NettyResponseFuture task cancel: serverPort=172.13.80.68:8002 requestId=146147160103200001 interface=com.zdmoney.assets.api.motan.FooService method=hello(java.lang.String) cost=249, status: 503, error_code: 10001,r=
at com.weibo.api.motan.transport.netty.NettyResponseFuture.cancel(NettyResponseFuture.java:151)
at com.weibo.api.motan.transport.netty.NettyClient$TimeoutMonitor.run(NettyClient.java:482)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
12:20:01.397 [main] ERROR error - RefererInvocationHandler invoke Error: uri=motan://172.13.80.68:0/com.zdmoney.assets.api.motan.FooService requestId=146147160103200001 interface=com.zdmoney.assets.api.motan.FooService method=hello(java.lang.String)
com.weibo.api.motan.exception.MotanServiceException: error_message: NettyResponseFuture task cancel: serverPort=172.13.80.68:8002 requestId=146147160103200001 interface=com.zdmoney.assets.api.motan.FooService method=hello(java.lang.String) cost=249, status: 503, error_code: 10001,r=
at com.weibo.api.motan.transport.netty.NettyResponseFuture.cancel(NettyResponseFuture.java:151) ~[motan-transport-netty-0.0.1.jar:na]
at com.weibo.api.motan.transport.netty.NettyClient$TimeoutMonitor.run(NettyClient.java:482) ~[motan-transport-netty-0.0.1.jar:na]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) ~[na:1.8.0_25]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308) ~[na:1.8.0_25]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180) ~[na:1.8.0_25]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294) ~[na:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) ~[na:1.8.0_25]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) ~[na:1.8.0_25]
at java.lang.Thread.run(Thread.java:745) ~[na:1.8.0_25]
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
12:20:01.467 [New I/O client worker #1-2] WARN warn - NettyClient has response from server, but resonseFuture not exist, requestId=146147160103200001

motan规划

motan后续计划是什么?是否考虑集成spring cloud相关组件,比如config server, zuul, 以及进一步完善服务治理...

使用git中简单示例 报错。是否遗漏什么配置参数了?

Exception in thread "main" com.weibo.api.motan.exception.MotanServiceException: error_message: NettyResponseFuture task cancel: serverPort=localhost:8002 requestId=146285695919400002 interface=com.huateng.xxx.service.FooService method=hello(java.lang.String) cost=212, status: 503, error_code: 10001,r=
at com.weibo.api.motan.transport.netty.NettyResponseFuture.cancel(NettyResponseFuture.java:151)
at com.weibo.api.motan.transport.netty.NettyClient$TimeoutMonitor.run(NettyClient.java:482)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:304)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

motan是否支持其他序列化方式

版本0.1.0,看目前的文档,motan目前似乎只支持hessian序列化方式,还支持其他序列化方式么?未来有预期增加序列化方式么?如果我要增加一种序列化方式,我可以如何写一些代码来扩展motan?

使用Consul作为注册中心,如何启用TTL

1.当使用Consul作为注册中心时,如何启用TTL以及如何修改默认group?
image
2.如何修改默认的group?我尝试做了如下配置:
server:<motan:registry regProtocol="consul" name="consul" address="127.0.0.1:8500?group=testGroup" check="true" /> <motan:service interface="quickstart.FooService" ref="serviceImpl" export="8002" shareChannel="true" group="testGroup"/>
client:<motan:registry regProtocol="consul" name="consul" address="127.0.0.1:8500?group=testGroup"/> <motan:referer id="remoteService" interface="quickstart.FooService" group="testGroup"/>

client堆栈如下:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'remoteService': FactoryBean threw exception on object creation; nested exception is com.weibo.api.motan.exception.MotanFrameworkException: error_message: ClusterSupport No service urls for the refer:motan://172.16.69.17:0/testGroup/quickstart.FooService/1.0/referer, registries:[consul://127.0.0.1:8500/com.weibo.api.motan.registry.RegistryService?group=testGroup], status: 404, error_code: 10101,r=
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1523)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:956)
at quickstart.Client.main(Client.java:12)
Caused by: com.weibo.api.motan.exception.MotanFrameworkException: error_message: ClusterSupport No service urls for the refer:motan://172.16.69.17:0/testGroup/quickstart.FooService/1.0/referer, registries:[consul://127.0.0.1:8500/com.weibo.api.motan.registry.RegistryService?group=testGroup], status: 404, error_code: 10101,r=
at com.weibo.api.motan.cluster.support.ClusterSupport.init(ClusterSupport.java:102)
at com.weibo.api.motan.config.handler.SimpleConfigHandler.buildClusterSupport(SimpleConfigHandler.java:55)
at com.weibo.api.motan.config.RefererConfig.createClusterSupport(RefererConfig.java:184)
at com.weibo.api.motan.config.RefererConfig.initRef(RefererConfig.java:128)
at com.weibo.api.motan.config.RefererConfig.getRef(RefererConfig.java:85)
at com.weibo.api.motan.config.springsupport.RefererConfigBean.getObject(RefererConfigBean.java:41)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 6 more

多线程bug

ReflectUtil.class

private static final Map<String, Class<?>> name2ClassCache = new HashMap<String, Class<?>>();
...
Class<?> clz = name2ClassCache.get(className);
if (clz != null) {
    return clz;
}
clz = forNameWithoutCache(className);
if (clz != null) {
    // 应该没有内存消耗过多的可能,除非有些代码很恶心,创建特别多的类
    name2ClassCache.put(className, clz);
}

hashmap在多线程并发put/get时应该有问题

demo中MotanApiClientDemo使用的协议不匹配?

你好,
还不是很清楚配置,在IDE中调试demo程序,基于spring配置的demo运行正常:
Hello motan0! Hello motan1! Hello motan2! Hello motan3! Hello motan4! Hello motan5! Hello motan6! Hello motan7!
非spring启动失败,步骤如下:
运行MotanApiExportDemo,启动成功。
运行MotanApiClientDemo,异常堆栈信息:

Exception in thread "main" com.weibo.api.motan.exception.MotanFrameworkException: error_message: ClusterSupport No service urls for the refer:motan://192.168.1.100:0/motan-demo-rpc/com.weibo.motan.demo.service.MotanDemoService/1.0/referer, registries:[local://127.0.0.1:0/com.weibo.api.motan.registry.RegistryService?group=default_rpc], status: 404, error_code: 10101,r=
    at com.weibo.api.motan.cluster.support.ClusterSupport.init(ClusterSupport.java:102)
    at com.weibo.api.motan.config.handler.SimpleConfigHandler.buildClusterSupport(SimpleConfigHandler.java:52)
    at com.weibo.api.motan.config.RefererConfig.createClusterSupport(RefererConfig.java:184)
    at com.weibo.api.motan.config.RefererConfig.initRef(RefererConfig.java:128)
    at com.weibo.api.motan.config.RefererConfig.getRef(RefererConfig.java:85)
    at com.weibo.motan.demo.client.MotanApiClientDemo.main(MotanApiClientDemo.java:49)

定位到ClusterSupport类

throw new MotanFrameworkException(String.format("ClusterSupport No service urls for the refer:%s, registries:%s",
                this.url.getIdentity(), registryUrls), MotanErrorMsgConstant.SERVICE_UNFOUND);

猜测是client寻找的服务refer与server注册的服务协议不一致?

希望尽快提供develop guide以便参与维护。

在配合zookeeper使用时出现问题

Exception in thread "main" com.weibo.api.motan.exception.MotanFrameworkException: error_message: register error! Could not find extension for registry protocol:zookeeper, make sure registry module for zookeeper is in classpath!, status: 500, error_code: 20008,r=
这是什么原因?

运行motan-demo报错

运行motan-demo的motan-demo-client中的DemoRpcClient,spring装配,zookeeper注册中心,motan版本0.1.0,报错如下,

Connected to the target VM, address: '127.0.0.1:49527', transport: 'socket'
Disconnected from the target VM, address: '127.0.0.1:49527', transport: 'socket'
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'motanDemoReferer': FactoryBean threw exception on object creation; nested exception is com.weibo.api.motan.exception.MotanFrameworkException: error_message: Create registry false for url:zookeeper://127.0.0.1:2181/com.weibo.api.motan.registry.RegistryService?group=default_rpc, status: 503, error_code: 20004,r=
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:175)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1585)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1051)
at com.weibo.motan.demo.client.DemoRpcClient.main(DemoRpcClient.java:29)
Caused by: com.weibo.api.motan.exception.MotanFrameworkException: error_message: Create registry false for url:zookeeper://127.0.0.1:2181/com.weibo.api.motan.registry.RegistryService?group=default_rpc, status: 503, error_code: 20004,r=
at com.weibo.api.motan.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:63)
at com.weibo.api.motan.cluster.support.ClusterSupport.getRegistry(ClusterSupport.java:129)
at com.weibo.api.motan.cluster.support.ClusterSupport.init(ClusterSupport.java:89)
at com.weibo.api.motan.config.handler.SimpleConfigHandler.buildClusterSupport(SimpleConfigHandler.java:52)
at com.weibo.api.motan.config.RefererConfig.createClusterSupport(RefererConfig.java:184)
at com.weibo.api.motan.config.RefererConfig.initRef(RefererConfig.java:128)
at com.weibo.api.motan.config.RefererConfig.getRef(RefererConfig.java:85)
at com.weibo.api.motan.config.springsupport.RefererConfigBean.getObject(RefererConfigBean.java:41)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:168)
... 6 more
Caused by: org.I0Itec.zkclient.exception.ZkTimeoutException: Unable to connect to zookeeper server within timeout: 200
at org.I0Itec.zkclient.ZkClient.connect(ZkClient.java:880)
at org.I0Itec.zkclient.ZkClient.(ZkClient.java:98)
at org.I0Itec.zkclient.ZkClient.(ZkClient.java:92)
at org.I0Itec.zkclient.ZkClient.(ZkClient.java:80)
at com.weibo.api.motan.registry.zookeeper.ZookeeperRegistryFactory.createRegistry(ZookeeperRegistryFactory.java:44)
at com.weibo.api.motan.registry.support.AbstractRegistryFactory.getRegistry(AbstractRegistryFactory.java:56)
... 14 more

但是,motan-demo-server没有报错,是不是我哪里配错了?或者是环境问题?

SSH 项目配置问题?

您好,
想在现有的SSH项目中加入motan,对外提供RPC接口
如何在SSH项目中配置呢?
web.xml怎么配置?

j.u.c 并发包下线程安全类上加synchronized对findbugs不友好

如:ExtensionLoader getSingletonInstance方法里 synchronized (singletonInstances):
findbugs提示This method performs synchronization an object that is an instance of a class from the java.util.concurrent package (or its subclasses). Instances of these classes have their own concurrency control mechanisms that are orthogonal to the synchronization provided by the Java keyword synchronized. For example, synchronizing on an AtomicBoolean will not prevent other threads from modifying the AtomicBoolean.
虽然没什么问题,建议把synchronized 块重构为synchronized 方法。

support PHP yar protocol

Yar is a widely used php rpc framework. We could implement the protocol of yar to support cross-language invocation.

There might be three steps:

  • Support yar protocol for Motan server, then a php yar client could call java services
  • Support yar protocol for Motan client. It might be a little harder because of we need to support short connection on Motan client side.
  • Support long connection on php side to improve performance, maybe http/2 is a good option.

loadbalance LocalFirstLoadBalance

  1. LocalFirstLoadBalance.searchLocalReferer
    long local = ipToLong(localhost);
    放在循环里面是不是有点浪费?
  2. LocalFirstLoadBalance.doSelectToHolder
    if (localReferers.isEmpty()) {
    Collections.sort(localReferers, new LowActivePriorityComparator());
    refersHolder.addAll(localReferers);
    }
    也不太对劲

文档中对basicService内属性的说明问题

该wiki中(https://github.com/weibocom/motan/wiki/zh_userguide ) 对basicService的配置说明如下:

使用basicService简化配置

<motan:basicService .../>
rpc服务的通用配置,用于配置所有服务接口的公共配置,减少配置冗余。basicService包含以下常用属性:

id:标识配置项
export:标识服务的暴露方式,格式为“protocolId:port”(使用的协议及对外提供的端口号),其中protocolId:应与motan:protocol中的name对应
group:标识服务的分组
module:标识模块信息
protocol:标识service使用的协议,与motan:protocol中的name对应,默认为motan协议
registry:标识service使用的注册中心,与motan:registry中的name对应

但在 http://api.weibo.com/schema/motan.xsd 中,未见basicService内有protocol。(导致IDE配置protocol时会报错)

demo项目打包问题(demo_guide.md文档描述不准确,motan-demo-xxx/src/main/bin缺失)

你好,
根据motan-demo/demo_guide.md的说明,在motan-demo下执行 mvn clean package 之后,motan-demo-xxx/target/目录中并没有生成xxx.tar.gz的文件
我看了pom.xml之后发现除了需要执行mvn clean package,还需要进入子模块目录执行 mvn assembly:single才会生成xxx.tar.gz。
但是tar.gz的压缩包解压之后,没有bin目录,查看motan-demo-server/src/main/assembly/assembly.xml文件,${project.basedir}/src/main/bin,貌似代码中并没有这个目录。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.