Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 88129cc

Browse filesBrowse files
committed
[A] 添加dubbo SPI机制文章
1 parent c6d20c1 commit 88129cc
Copy full SHA for 88129cc

File tree

Expand file treeCollapse file tree

5 files changed

+7
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

5 files changed

+7
-5
lines changed
Open diff view settings
Collapse file

‎…te/Dubbo/Dubbo底层源码学习(二)—— Dubbo的SPI机制.md‎ ‎…Dubbo/Dubbo底层源码学习(二)—— Dubbo的SPI机制(上).md‎note/Dubbo/Dubbo底层源码学习(二)—— Dubbo的SPI机制.md renamed to note/Dubbo/Dubbo底层源码学习(二)—— Dubbo的SPI机制(上).md note/Dubbo/Dubbo底层源码学习(二)—— Dubbo的SPI机制.md renamed to note/Dubbo/Dubbo底层源码学习(二)—— Dubbo的SPI机制(上).md

Copy file name to clipboardExpand all lines: note/Dubbo/Dubbo底层源码学习(二)—— Dubbo的SPI机制(上).md
+7-5Lines changed: 7 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ dubbo=org.apache.dubbo.rpc.protocol.dubbo.DubboProtocol
8686
```
8787

8888
key表示的是扩展点名称,而value表示的是扩展点的实现类的全限定类名。另外,SPI配置文件名称就是扩展点实现类的全限定类名。
89-
![Dubbo-SPI-01](http://note.youdao.com/yws/res/28338/6061E217061B4FEBB4A05588B7DD42BC)
89+
![Dubbo-SPI-01](https://github.com/coderbruis/JavaSourceCodeLearning/blob/master/note/images/Dubbo/dubbo-spi-01.png)
9090

9191
那么,扩展点及其实现类以及存放在SPI文件中了,那么Dubbo应用程序该如何将其加载进行JVM内存中呢?
9292

@@ -95,9 +95,9 @@ key表示的是扩展点名称,而value表示的是扩展点的实现类的全
9595
ExtensionLoader即扩展点加载器,它是Dubbo SPI的核心,负责加载扩展点即扩展点实现类,先看下其内部重要的几个成员变量:
9696

9797

98-
![Dubbo-SPI-02](http://note.youdao.com/yws/res/28352/F560C187FC8D4B7EB9F54DCE4103A5EB)
98+
![Dubbo-SPI-02](https://github.com/coderbruis/JavaSourceCodeLearning/blob/master/note/images/Dubbo/dubbo-spi-02.png)
9999

100-
![Dubbo-SPI-03](http://note.youdao.com/yws/res/28354/6811B40CCC184FC1B2B2C5E557D6D534)
100+
![Dubbo-SPI-03](https://github.com/coderbruis/JavaSourceCodeLearning/blob/master/note/images/Dubbo/dubbo-spi-03.png)
101101

102102
这里的扩展点加载策略有三种:
103103
- DubboInternalLoadingStrategy(加载内部的SPI)
@@ -106,7 +106,7 @@ ExtensionLoader即扩展点加载器,它是Dubbo SPI的核心,负责加载
106106

107107
并且其内部默认优先级为:DubboInternalLoadingStrategy > DubboLoadingStrategy > ServiceLoadingStrategy
108108

109-
![image](http://note.youdao.com/yws/res/28367/9F45ECAA6A1F418582172C41137FB3C9)
109+
![Dubbo-SPI-04](https://github.com/coderbruis/JavaSourceCodeLearning/blob/master/note/images/Dubbo/dubbo-spi-04.png)
110110

111111
上图清楚的展示了LoadingStrategy接口及其实现类的关系。LoadingStrategy继承了Prioritized,因而其实现类会有优先级之分,而Dubbo默认是使用的DubboInternalLoadingStrategy,查看其三个类的源码:
112112

@@ -209,4 +209,6 @@ public class ServicesLoadingStrategy implements LoadingStrategy {
209209

210210
所以在Dubbo中,默认的优先级为:DubboInternalLoadingStrategy > DubboLoadingStrategy > ServiceLoadingStrategy
211211

212-
即优先加载:META-INF/dubbo/internal目录下的SPI配置文件。
212+
即优先加载:META-INF/dubbo/internal目录下的SPI配置文件。
213+
214+
> 由于篇幅过长,关于Dubbo SPI机制的原理分析将分为上、中、下三篇
Collapse file

‎note/images/Dubbo/dubbo-spi-01.png‎

Copy file name to clipboard
59.7 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎note/images/Dubbo/dubbo-spi-02.png‎

Copy file name to clipboard
270 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎note/images/Dubbo/dubbo-spi-03.png‎

Copy file name to clipboard
187 KB
  • Display the source diff
  • Display the rich diff
Loading
Collapse file

‎note/images/Dubbo/dubbo-spi-04.png‎

Copy file name to clipboard
52.2 KB
  • Display the source diff
  • Display the rich diff
Loading

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.