dubbo SPI扩展点,激活扩展点获取实例的详细流程图
2020-09-30 14:31:39 0 举报
dubbo SPI扩展点,激活扩展点获取实例的详细流程图
作者其他创作
大纲/内容
loadExtensionClassesload cachedActivates
no
namesdoes not contain \"-\" + cachedActivate name
getExtensionClasses
names size > 0
if cachedClassesis null
load all the extension classes to global variableExtensionLoader.loadExtensionClasses()
get clazz simple name and toLowerCase
extensionClasses
yes
cache ActivateClass
namesdoes not contain cachedActivate name
cachedActivates.put(font color=\"#ff3333\
names do not contain \"-\" + name
add into activateExtensions
has next one
Dubbo SPIThe Process of Getting an Instance by Activate Way
has next one(name)
if clazz is annotated by Activate
if clazz isWrapperClass(has a constructor with only one param of interface type)
load extension class include(adaptive / wrapper / activate / normal)
get clazz extension name
if clazz isAnnotationPresent(Adaptive.class)
if names contains \"-default\"
if the interface type is annotated by @SPIfont color=\"#000000\
saveExtensionClasses
is cached instance type of Activate
load loadedExtensions into activateExtensions
throw exception(More than 1 adaptive class found)
load all extention classes of this type by strategies(actually load the classes in \"META-INF/dubbo/internal/\" \"META-INF/dubbo/\" \"META-INF/services/\" of this type)
obtain the instance by activationExtensionLoader.getExtensionLoader(Class type).getActivateExtension(font color=\"#ff0000\
cacheDefaultExtensionName
if cachedAdaptiveClass is null or the same as the clazz
check all names
set of cachedWrapperClasses add this clazz
check all cachedAvtives
set cachedAdaptiveClass
check and load activateExtension instances
nocachedActivates have already been loaded
isMatchGroup
name does not start wiith \"-\"
isActive(judge url params)
sort by ActivateComparator
return the list of activateExtensions
set cachedDefaultName in global variable
if clazz extension name is empty
0 条评论
下一页