码迷,mamicode.com
首页 > 其他好文 > 详细

dubbo源码阅读笔记--暴露服务时序

时间:2015-04-29 21:47:52      阅读:201      评论:0      收藏:0      [点我收藏+]

标签:dubbo   源码   rpc   

本文许多内容来源于http://dubbo.io/Developer+Guide-zh.htm#DeveloperGuide-zh-%E8%B0%83%E7%94%A8%E9%93%BE,感谢作者的分享。

dubbo的整体架构图中包含了很多内容,这里只分析服务暴露部分。

技术分享

针对服务暴露,对上面的图做了些简化

技术分享

时序图

技术分享

分成六个阶段,下面分别列出每个阶段的调用堆栈。

1 初始化接口invoker

JavassistProxyFactory.getInvoker(T, Class<T>, URL) line: 40	
StubProxyFactoryWrapper.getInvoker(T, Class<T>, URL) line: 104	
ProxyFactory$Adpative.getInvoker(Object, Class, URL) line: not available	
ServiceBean<T>(ServiceConfig<T>).exportLocal(URL) line: 516	
ServiceBean<T>(ServiceConfig<T>).doExportUrlsFor1Protocol(ProtocolConfig, List<URL>) line: 469	
ServiceBean<T>(ServiceConfig<T>).doExportUrls() line: 285	
ServiceBean<T>(ServiceConfig<T>).doExport() line: 246	
ServiceBean<T>(ServiceConfig<T>).export() line: 145




2 初始化exporter
DubboExporter<T>.<init>(Invoker<T>, String, Map<String,Exporter<?>>) line: 36	
DubboProtocol.export(Invoker<T>) line: 240	
ProtocolFilterWrapper.export(Invoker<T>) line: 55	
ProtocolListenerWrapper.export(Invoker<T>) line: 56	
Protocol$Adpative.export(Invoker) line: not available	
ServiceBean<T>(ServiceConfig<T>).doExportUrlsFor1Protocol(ProtocolConfig, List<URL>) line: 495	
ServiceBean<T>(ServiceConfig<T>).doExportUrls() line: 285	
ServiceBean<T>(ServiceConfig<T>).doExport() line: 246	
ServiceBean<T>(ServiceConfig<T>).export() line: 145	



3 初始化server
DubboProtocol.createServer(URL) line: 318	
DubboProtocol.openServer(URL) line: 308	
DubboProtocol.export(Invoker<T>) line: 258	
ProtocolFilterWrapper.export(Invoker<T>) line: 55	
ProtocolListenerWrapper.export(Invoker<T>) line: 56	
Protocol$Adpative.export(Invoker) line: not available	
ServiceBean<T>(ServiceConfig<T>).doExportUrlsFor1Protocol(ProtocolConfig, List<URL>) line: 495	
ServiceBean<T>(ServiceConfig<T>).doExportUrls() line: 285	
ServiceBean<T>(ServiceConfig<T>).doExport() line: 246	
ServiceBean<T>(ServiceConfig<T>).export() line: 145	




4 绑定transporter
NettyTransporter.bind(URL, ChannelHandler) line: 33	
Transporter$Adpative.bind(URL, ChannelHandler) line: not available	
Transporters.bind(URL, ChannelHandler...) line: 48	
HeaderExchanger.bind(URL, ExchangeHandler) line: 41	
Exchangers.bind(URL, ExchangeHandler) line: 63	
DubboProtocol.createServer(URL) line: 329	
DubboProtocol.openServer(URL) line: 308	
DubboProtocol.export(Invoker<T>) line: 258	
ProtocolListenerWrapper.export(Invoker<T>) line: 56	
ProtocolFilterWrapper.export(Invoker<T>) line: 55	
Protocol$Adpative.export(Invoker) line: not available	
ServiceBean<T>(ServiceConfig<T>).doExportUrlsFor1Protocol(ProtocolConfig, List<URL>) line: 495	
ServiceBean<T>(ServiceConfig<T>).doExportUrls() line: 285	
ServiceBean<T>(ServiceConfig<T>).doExport() line: 246	
ServiceBean<T>(ServiceConfig<T>).export() line: 145	



5 初始化codec
NettyServer(AbstractEndpoint).<init>(URL, ChannelHandler) line: 47	
NettyServer(AbstractServer).<init>(URL, ChannelHandler) line: 59	
NettyServer.<init>(URL, ChannelHandler) line: 63	
NettyTransporter.bind(URL, ChannelHandler) line: 33	
Transporter$Adpative.bind(URL, ChannelHandler) line: not available	
Transporters.bind(URL, ChannelHandler...) line: 48	
HeaderExchanger.bind(URL, ExchangeHandler) line: 41	
Exchangers.bind(URL, ExchangeHandler) line: 63	
DubboProtocol.createServer(URL) line: 329	
DubboProtocol.openServer(URL) line: 308	
DubboProtocol.export(Invoker<T>) line: 258	
ProtocolListenerWrapper.export(Invoker<T>) line: 56	
ProtocolFilterWrapper.export(Invoker<T>) line: 55	
Protocol$Adpative.export(Invoker) line: not available	
RegistryProtocol.doLocalExport(Invoker<T>) line: 153	
RegistryProtocol.export(Invoker<T>) line: 107	
ProtocolListenerWrapper.export(Invoker<T>) line: 54	
ProtocolFilterWrapper.export(Invoker<T>) line: 53	
Protocol$Adpative.export(Invoker) line: not available	
ServiceBean<T>(ServiceConfig<T>).doExportUrlsFor1Protocol(ProtocolConfig, List<URL>) line: 489	
ServiceBean<T>(ServiceConfig<T>).doExportUrls() line: 285	
ServiceBean<T>(ServiceConfig<T>).doExport() line: 246	
ServiceBean<T>(ServiceConfig<T>).export() line: 145	



6 初始化channelHandler
AllChannelHandler(WrappedChannelHandler).<init>(ChannelHandler, URL) line: 47	//------------6
AllChannelHandler.<init>(ChannelHandler, URL) line: 32	
AllDispatcher.dispatch(ChannelHandler, URL) line: 32	
Dispatcher$Adpative.dispatch(ChannelHandler, URL) line: not available	
ChannelHandlers.wrapInternal(ChannelHandler, URL) line: 40	
ChannelHandlers.wrap(ChannelHandler, URL) line: 33	
NettyServer.<init>(URL, ChannelHandler) line: 63	//------------------5
NettyTransporter.bind(URL, ChannelHandler) line: 33	//-------------------4
Transporter$Adpative.bind(URL, ChannelHandler) line: not available	
Transporters.bind(URL, ChannelHandler...) line: 48	
HeaderExchanger.bind(URL, ExchangeHandler) line: 41	
Exchangers.bind(URL, ExchangeHandler) line: 63	
DubboProtocol.createServer(URL) line: 329	//----------------------3
DubboProtocol.openServer(URL) line: 308	
DubboProtocol.export(Invoker<T>) line: 258	
ProtocolFilterWrapper.export(Invoker<T>) line: 55	
ProtocolListenerWrapper.export(Invoker<T>) line: 56	
Protocol$Adpative.export(Invoker) line: not available	
RegistryProtocol.doLocalExport(Invoker<T>) line: 153	
RegistryProtocol.export(Invoker<T>) line: 107	
ProtocolFilterWrapper.export(Invoker<T>) line: 53	
ProtocolListenerWrapper.export(Invoker<T>) line: 54	//------------------2
Protocol$Adpative.export(Invoker) line: not available	
ServiceBean<T>(ServiceConfig<T>).doExportUrlsFor1Protocol(ProtocolConfig, List<URL>) line: 489	//-------------1
ServiceBean<T>(ServiceConfig<T>).doExportUrls() line: 285	
ServiceBean<T>(ServiceConfig<T>).doExport() line: 246	
ServiceBean<T>(ServiceConfig<T>).export() line: 145	




dubbo源码阅读笔记--暴露服务时序

标签:dubbo   源码   rpc   

原文地址:http://blog.csdn.net/liuqi0622/article/details/45370779

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!