StandarServer.java 所在包package org.apache.catalina.core;
public final class StandardServer
implements Lifecycle, Server, MBeanRegistration
从上节分析可以看到,Catalina.java主要执行了。
server.initialize();
server.start();
我们来看看
server.initialize();主要做了什么.
-----------------------------------------------------------------
/**
* Invoke a pre-startup initialization. This is used to allow connectors
* to bind to restricted ports under Unix operating environments.
*/
public void initialize()
throws LifecycleException
{
if (initialized) {
log.info(sm.getString("standardServer.initialize.initialized"));
return;
}
lifecycle.fireLifecycleEvent(INIT_EVENT, null);
initialized = true;
// Initialize our defined Services
for (int i = 0; i < services.length; i++) {
services.initialize();
}
}
注:从源码分析,初始化过程,也就是设置一些属性.
我们再来看看.
server.start();
-----------------------------------------------------------------
/**
* Prepare for the beginning of active use of the public methods of this
* component. This method should be called before any of the public
* methods of this component are utilized. It should also send a
* LifecycleEvent of type START_EVENT to any registered listeners.
*
* @exception LifecycleException if this component detects a fatal error
* that prevents this component from being used
*/
public void start() throws LifecycleException {
// Validate and update our current component state
if (started) {
log.debug(sm.getString("standardServer.start.started"));
return;
}