The Start method of Catalina
/*** Start A new server instance. */ Public voidstart () {if(Server = =NULL) {load (); } LongT1 =System.nanotime (); //Start the new server if(ServerinstanceofLifecycle) { Try{(Lifecycle) server). Start ();//Start the server}Catch(lifecycleexception e) {log.error ("Catalina.start:", E); } } Longt2 =System.nanotime (); if(log.isinfoenabled ()) Log.info ("Server Startup in" + ((T2-T1)/1000000) + "MS"); Try { //Register shutdown Hook if(useshutdownhook) {if(Shutdownhook = =NULL) {Shutdownhook=NewCatalinashutdownhook (); } runtime.getruntime (). Addshutdownhook (Shutdownhook); } } Catch(Throwable t) {//This is fail on JDK 1.2. Ignoring, as Tomcat can run//fine without the shutdown hook. } //start complete waiting for client connection if(await) {await (); Stop (); } }
Start the service when you start the server.
Public voidStart ()throwslifecycleexception {//Validate and update our current component state if(started) {Log.debug (sm.getstring ("StandardServer.start.started")); return; } //Notify our interested lifecyclelistenersLifecycle.firelifecycleevent (Before_start_event,NULL); Lifecycle.firelifecycleevent (Start_event,NULL); Started=true; //Start our defined Services synchronized(services) { for(inti = 0; i < services.length; i++) { if(Services[i]instanceofLifecycle) ((Lifecycle) services[i]). Start ();//Start Service } } //Notify our interested lifecyclelistenersLifecycle.firelifecycleevent (After_start_event,NULL); }
Spring container Start-up process (iii)