Tomcat源码解读--代码走读之(十八的2)StandardServer. startInternal(十九)



 

1、fireLifecycleEvent(CONFIGURE_START_EVENT,null),其中CONFIGURE_START_EVENT = "configure_start"。其中6个listeners。
(1)、NamingContextListener

        1)、将NamingResources的namingResources 赋值为server.xml的GlobalNamingResources对象。

        2)、创建一个对象namingContext,是hashtable结构。

        3)、securityTokens.put(name,token),其中name=/,token= StandardServer[8005].

        4)、ContextBindings.bindContext(container,namingContext, container),其中container为StandardServer[8005].里面的步骤为contextNameBindings.put(name, context),其中name= StandardServer[8005],context= NamingContext上一步构建的。

        5)、ContextAccessController.setWritable(getName(),container);里面的步骤为readOnlyContexts.remove(name); 其中name为/。

        6)、createNamingContext(),主要是检查Resourcelinks、Resources(server.xml的GlobalNamingResources的Resource,其中这里面对对象进行包装)、Resources Env、Environment entries、EJB references、WebServices references、Binding a User Transaction reference、Binding theresources directory context

        7)、ContextBindings.bindClassLoader (container, container,  this.getClass().getClassLoader()),其中container=StandardServer[8005]this.getClass().getClassLoader()=sun.misc.Launcher$AppClassLoader@18d107f。意味着classloader与container做绑定,步骤如下。



 

(2)、AprLifecycleListener,在此阶段没有动作。

(3)、JasperListener,在此阶段没有动作。

(4)、JreMemoryLeakPreventionListener,在此阶段没有动作。

(5)、GlobalResourcesLifecycleListener,在此阶段没有动作。

(6)、ThreadLocalLeakPreventionListener,在此阶段没有动作。

2、setState(LifecycleState.STARTING),LifecycleState.STARTING=“start”流程还是6个listeners。(1)、NamingContextListener,在此阶段没有动作。

(2)、AprLifecycleListener,在此阶段没有动作。

(3)、JasperListener,在此阶段没有动作。

(4)、JreMemoryLeakPreventionListener,在此阶段没有动作。

(5)、GlobalResourcesLifecycleListener,创建mbean

(6)、ThreadLocalLeakPreventionListener,在此阶段没有动作。

3、globalNamingResources.start(),因为listeners为0,所以在此阶段没有动作。

4、services[i].start(),后续介绍。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值