JVM —— 虚拟机层 目的:Dubbo 框架之间完全隔离(端口不能复用)
Dubbo Framework —— 框架层 目的:将需要全局缓存的进行复用(端口、序列化等)
Application —— 应用层 目的:隔离应用之间的信息,包括注册中心、配置中心、元数据中心
Services —— 模块层 目的:提供热加载能力,可以按 ClassLoader、Spring Context 进行隔离上下文
Qos、Protocol、Remoting、Serialization、ExtensionLoader
ConfigManager(应用级)、DubboBootstrap(类 Fluent API)、Registry、Metadata、ServiceInstance、ConfigCenter、ExtensionLoader
ConsumerModel、ProviderModel、Router、Filter、ExtensionLoader
DefaultModel - FrameworkModel、ApplicationModel、ModuleModel
ModuleModel.getExtensionFactory().getAdaptiveExtension(Protocol.class)
ApplicationModel.getExtensionFactory().getAdaptiveExtension(Protocol.class)
FrameworkModel.getExtensionFactory().getAdaptiveExtension(Protocol.class)
@SPI(scope = FRAMEWORK)
public interface Protocol {
}
// 创建新应用实例,共享FrameworkModel
DubboBootstrap.newInstance(FrameworkModel) // SharedFrameworkModel -> NewApplicationModel
.addModule() // New ModuleModel
.addReference(ReferenceConfig) // 将服务配置挂到模块下
.addReference(ReferenceConfig)
.addService(ServiceConfig)
.endModule()
.addModule()
.addReference(ReferenceConfig)
.addService(ServiceConfig)
.endModule()
.addRegistry()
.addConfigCenter()
.start()
// 兼容旧的Bootstrap API,使用默认应用实例
DubboBootstrap.getInstance() // DefaultFrameworkModel -> DefaultApplicationModel
.addReference(ReferenceConfig) // DefaultApplicationModel -> DefaultModuleModel
.addService(ServiceConfig) // DefaultApplicationModel -> DefaultModuleModel
.setRegistry() // DefaultApplicationModel
.start()
// 新建应用实例
DubboBootstrap.newInstance() // DefaultFrameworkModel -> NewApplicationModel
.addReference(ReferenceConfig) // NewApplicationModel -> DefaultModuleModel
.addService(ServiceConfig) // NewApplicationModel -> DefaultModuleModel
.setRegistry() // NewApplicationModel
.start()
RefenceConfig、ServiceConfig
ModuleModel、ApplicationModel、FrameworkModel
ConsumerModel、ProviderModel
注册中心需要支持多订阅
Spring
ModuleModel、ApplicationModel、FrameworkModel(ExtensionLoader)
RefenceConfig、ServiceConfig(ConsumerModel、ProviderModel)
ExtensionLoader (Filter 改动)