DefaultSingletonBeanRegistry

earlySingletonObjects: contains bean haven't been injected.
dependentBeanMap: <bean -- set bean called the key bean>
dependenciesForBeanMap: <bean -- set bean be called by the key bean>
containedBeanMap: <bean -- set bean be contained>
desposableBeans: <bean -- bean that actually exec destroy function >

1.add
1.1 addSingleton
add to singletonObjects
remove from singletonFactories
remove from earlySingletonObjects
add to registeredSingletons
1.2 addSingletonFactory: resolve circular references
if singletonObjects not contains then bean,then
remove from singletonFactories
remove from earlySingletonObjects
add to registeredSingletons
end if;


1.3 registerDisposableBean
add to disposableBeans,

1.4 registerDependentBean
add to dependentBeanMap
add to dependenciesForBeanMap

1.5 registerContainedBean
add to containedBeanMap
add to dependentBeanMap
add to dependenciesForBeanMap


2.get
2.1 get with ObjectFactory
search singletonObjects
if singletonObjects not have , then
call beforeSingletonCreation
get from ObjectFactory
call afterSingletonCreation
add to singletonObjects
remove from singletonFactories
remove from earlySingletonObjects
add to registeredSingletons
end if;
2.2 get with none ObjectFactory
search singletonObjects
if singletonObjects not have ,then
search earlySingletonObjects
if not have , then
get from ObjectFactory
add to earlySingletonObjects
remove from singletonFactories
add to singletonObjects
end if;
end if;

3.select if exists
search singletonObjects

4.destory
4.1 destory single element
remove from singletonObjects
remove from singleFactories
remove from earlySingletonObjects
remove from registeredSingletons
remove from disposableBeans
destory beans that called this bean
destory this
destory contained beans
remove from dependentBeanMap (remove reference for this bean called)
remove from dependenciesForBeanMap
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值