DUBBO 源码分析(2): 整体架构
2019-09-03 13:08:08 5 举报
dubbo源码分析
作者其他创作
大纲/内容
RpcInvocation
AbstractClient
HeaderExchangeClient
bind
connected/sent/disconnected/received...
new
AbstractEndpoint
- Codec2 codec;- int timeout;- int connectTimeout;
Protocol
init
Invoker<?> invoker;
DubboProtocol
Exporter<T>
+ Invoker<T> getInvoker();+ void unexport();
Registry getRegistry(URL url);
Interface
invoke
void export();
NotifyListener
attachment;
源码版本: 2.6.7-release. 参考文档: http://dubbo.apache.org/zh-cn/docs/source_code_guide/adaptive-extension.htmlby chess-player
Cluster
addLast
AbstractServer
List<Exporter<?>> exporters;
+ <T> Invoker<T> join(Directory<T> directory);
Invoker<T> stickyInvoker;
received
- ExchangeServer createServer(URL url);
RegistryService
get
Directory<T>
+ Class<T> getInterface();+ List<Invoker<T>> list(Invocation invocation);
Exporter<T> export(Invoker<T> invoker);
Transport
void doOpen();标准的 netty server创建过程.
Dispatcher
AbstractLoadBalance
export
ExchangeServer createServer(URL url);
ExporterChangeableWrapper<T> doLocalExport(final Invoker<T> originInvoker);
Cluster cluster;
ChannelHandlers
Directory<T> directory;
getProxy
AbstractClusterInvoker
JavassistProxyFactory
call
Invoker<T>
+ Class<T> getInterface();+ Result invoke(Invocation invocation);
AbstractPeer
ExchangeServer
+ Collection<ExchangeChannel> getExchangeChannels();+ ExchangeChannel getExchangeChannel(InetSocketAddress remoteAddress);
ExchangeClient[] clients;
ExchangeClient
RouterFactory
+ Router getRouter(URL url);
select
NettyServer
list
RegistryDirectory<T>
- cluster;- routerFactory;
refer
abstract Result doInvoke(Invocation invocation);
+ Result invoke(Invocation invocation);
ConditionRouter
Protocol protocol;
Transporter
NettyHandler extends SimpleChannelHandler
ChannelHandler
List<Invoker<T>> list(Invocation invocation);
Client
+ void reconnect();
call facade method
Invocation
RegistryProtocol
notify
NettyTransporter
void doConnect();基于bootstrap.connect.
connect
HeaderExchangeServer
Implement
ChannelHandler handler;
Protocol refprotocol;
Router
Registry
TODO
wrap
Remoting
getRouter
getRegistry
getInvoker
void connect() ;
Business
AbstractRouter
protected URL url;protected int priority;
DubboInvoker
LoadBalance
TagRouter
Codec2
NettyClient
ProxyFactory
Node
+ URL getURL();+ boolean isAvailable();+ void destroy();
<T> T getProxy(Invoker<T> invoker);
void connected(Channel channel)
RPC
FailoverClusterInvoker
route
DubboExporter<T>
DubboInvoker<T>
Filter
create transporter
getInvoker()
final Set<Invoker<?>> invokers;
AbstractExporter<T>
- Invoker<T> invoker;+ public void unexport();
AbstractDirectory<T>
- URL url;- consumerUrl;- List<Router> routers;
Service
RoundRobinLoadBalance
+ Class<T> getInterface();+ Result invoke(Invocation invocation);
doClose();关闭 netty server
Endpoint
+ URL getUrl();+ ChannelHandler getChannelHandler();+ void send(Object message);+ void close();
Proxy
ExchangeHandler
void doOpen();标准的生成netty client方法.
Client client;
Exchanger
RpcContext
Invoker<?> invoker;用于保存调用上下文; 每次调用时设置;
Config
AvailableClusterInvoker
T get();
Exchange
FailfastClusterInvoker
Server
+ boolean isBound();+ Collection<Channel> getChannels();+ Channel getChannel(InetSocketAddress remoteAddress);
HeaderExchangeHandler
Server server;
RegistryFactory
ServiceConfig
Exporter<T> export(final Invoker<T> originInvoker);
merge
HeaderExchanger
DUBBO 源码分析: 整体架构
register/subscribe
dispatch
AbstractProtocol
exportLocal(URL url);
AbstractInvoker<T>
ReferenceConfig
private final URL url;
Exchangers
+ bind();+ connect();
ConsistentHashLoadBalance
AbstractInvoker
RpcContext getContext();
0 条评论
回复 删除
下一页