The study of Tomcat Source Code -- Party II
2012-12-04 13:00
453 查看
Tomcat is a big 'box'.
When we want this box work as a server, We had to start all of its contained small box and stuff(its components, such as contexts , wrappers, loaders, contexts' mappers,contexts'pipelines, wrappers' pipelines etc. )
It could be an annoy job to remember and to start all these components one by one. So as to 'stop'. Is there some effective way to get work done?
We know these components are hierarchical. If we start the biggest, and let the biggest to start its children. And then let children start grandson.
It could be perfect.
If children could be started and stopped by its father, it should get its 'start' and 'stop' method. Well, components implement the 'LifeCycle' interface whose methods include 'start' and 'stop'. Besides these two methods, if a component implements the 'LifeCycle',
it must be allowed to be added 'LifeCycleListener' to be listened when it take some action(So there is a method 'addLifeCycleListener' in LifeCycle interface).
It comes to reality that bigger containers can start its components when they implement 'LifeCycle' interface. But just as above said, components which implement the 'LifeCycle' interface could trigger event when it is added 'LifeCycleListener'. Well, here
comes anther problem: where the listener is stored and when relevant event is triggered, how listener take action to response. So 'LifeCycleSupport' come to life. 'LifeCycleSupport' class has 4 methods: addLifeCycleListener, removeLifeCycleListener,fireLifeCycleListener,
find LifeCycleListener. it has 1 arraylist of 'LifeListener'(interface) to hold to listeners. When it is called fireLifeCycleListener, this mehod enumerate the list of listener to check if the trigger and the event the trigger fit with the listener, if yes
do something.(check ... do something is the very method in LifeCycleListener interface)
When we want this box work as a server, We had to start all of its contained small box and stuff(its components, such as contexts , wrappers, loaders, contexts' mappers,contexts'pipelines, wrappers' pipelines etc. )
It could be an annoy job to remember and to start all these components one by one. So as to 'stop'. Is there some effective way to get work done?
We know these components are hierarchical. If we start the biggest, and let the biggest to start its children. And then let children start grandson.
It could be perfect.
If children could be started and stopped by its father, it should get its 'start' and 'stop' method. Well, components implement the 'LifeCycle' interface whose methods include 'start' and 'stop'. Besides these two methods, if a component implements the 'LifeCycle',
it must be allowed to be added 'LifeCycleListener' to be listened when it take some action(So there is a method 'addLifeCycleListener' in LifeCycle interface).
It comes to reality that bigger containers can start its components when they implement 'LifeCycle' interface. But just as above said, components which implement the 'LifeCycle' interface could trigger event when it is added 'LifeCycleListener'. Well, here
comes anther problem: where the listener is stored and when relevant event is triggered, how listener take action to response. So 'LifeCycleSupport' come to life. 'LifeCycleSupport' class has 4 methods: addLifeCycleListener, removeLifeCycleListener,fireLifeCycleListener,
find LifeCycleListener. it has 1 arraylist of 'LifeListener'(interface) to hold to listeners. When it is called fireLifeCycleListener, this mehod enumerate the list of listener to check if the trigger and the event the trigger fit with the listener, if yes
do something.(check ... do something is the very method in LifeCycleListener interface)
相关文章推荐
- 著名的安装制作软件InnoSetup的源码及示例源码-The installation of a well-known software s source code and sample InnoSetup source
- The source code of the Receiver class of the famous IM app
- The Logbook of Qt Source Code Reading(1)
- The source code of the SmsReceiver class of the famous IM app
- The Ultimate List of Open Source Static Code Analysis Security Tools
- View the format of IEEE 754 floating point numbers source code
- The source code of the BootCompletedReceiver class of the famous IM app
- How to get the source code of the chromium of the specified revision
- The source code of the Account class of the famous IM app
- The source code of A Web Game(看你能坚持几秒.htm)
- Chapter 1 A Guided Tour Of The MySQL Source Code
- The Attack of the Clones: A Study of the Impact of Shared Code on Vulnerability Patching
- The Source Code Of My World(我的世界之源代码)中的经典语句
- How to get the source code of the chromium of the specified revision
- why separate the source code of a codec into two p
- The Source Code of ActionScript 3 Cookie class
- Tomcat 解决The code of method _jspService(HttpServletRequest, HttpServletResponse) is exceeding the 65535 bytes limit
- why separate the source code of a codec into two p
- study on source code of Tcmalloc