/** * Bootstrap loader for Catalina. This application constructs a class loader * for use with loading the Catalina internal classes (by accumulating all of the * JAR files found in the "server" directory under "Catalina.home"), and * starts the regular execution of the container.
the purpose of this * roundabout approach are to keep the Catalina internal classes (and any * other classes they depend On, such as a XML parser) out of the system * class path and therefore not visible to application level classes.
This class constructs a classloader to load Catalina internal classes (by Catalina.home in the server directory to find all the jar files), and starts to execute container containers on a regular basis.
The purpose of this maneuver is to keep the Catalina inner class (and any other classes it relies on, such as an XML parser) out of the system classpath, so it is not visible to the application level
Entrance Main method
Perform static static module code before entering main: mainly to set the path of Catalina.home and Catalina.base
public static void Main (String args[]) {
Bootstrap init initialization ()
Set Daemon daemon = bootstrap;
Identify parameters to be passed when starting bootstrap command = Args[args.length-1];//start
Daemon.setawait (TRUE);
Daemon.load (args);
Daemon.start ();}
The method above Damemon daemon setawait (), load (), start () is actually a method of reflection called Org.apache.catalina.startup.Catalina class
In fact, into the Catalina class.
--------------------------Bootstrap class parsing is complete------The following is an explanation of the Init method---------------------------------------------------------
Initialize Init method (Initialize daemon):
The main process in this method
1. Initialize class loader initclassloaders----------commonloader,catalinaloader,sharedloade will load catalina.base/conf/first Catalina.propertises configuration file
Then read the value of the Common.loader key
2. Set ClassLoader for the current thread
Thread.CurrentThread (). Setcontextclassloader (Catalinaloader); Catalinaloader is actually commonloader.
Pre-load class resources with static class Securityclassload
Securityclassload.securityclassload (Catalinaloader);
Securityclassload (ClassLoader loader, Boolean Requiresecuritymanager) {
。。。。。 Slightly..........
Loadcorepackage (loader); Loadcoyotepackage (loader); Loadloaderpackage (loader); Loadrealmpackage (loader); Loadservletspackage (loader); Loadsessionpackage (loader); Loadutilpackage (loader); Loadvalvespackage (loader); Loadwebresourcespackage (loader); Loadjavaxpackage (loader); Loadconnectorpackage (loader); Loadtomcatpackage (loader);
}
3. Initialization Org.apache.catalina.startup.Catalina uses reflection to invoke its Setparentclassloader settings sharedloader; (The reason and usefulness of setting up the Parentclassloader is not entirely clear, see source estimation will be used in the Server.xml loading section)
Specific source analysis: http://blog.csdn.net/u011545486/article/details/52002626
Tomcat Launcher (ii) ORG.APACHE.CATALINA.STARTUP.BOOTSTRAP analysis