a6.findClass鏂規硶鏄垱寤哄畾鍒剁殑ClassLoader鏃跺敮涓闇瑕佽鐩栫殑鏂規硶銆?
ClassLoader loadClass鏂規硶
Class c = findLoadedClass(name);
if (c == null) {
try {
if (parent != null) {
c = parent.loadClass(name, false);
} else {
c = findBootstrapClass0(name);
}
} catch (ClassNotFoundException e) {
// If still not found, then invoke findClass in order
// to find the class.
c = findClass(name);
}
}
t4.Bootstrap閫氳繃鍙嶅皠鍒濆鍖朇atalina綾伙紝
鍙嶅皠璋冪敤Catalina鏂規硶setParentClassLoader錛屼紶閫扴haredClassloader
鍙嶅皠call Catalina鏂規硶load 鍒╃敤server.xml涓殑閰嶇疆鍒濆鍖朣ervice,Server,Engine,Host
鍙嶅皠call Catalina鏂規硶start Start the new server 璇erver鏄氳繃
瑙f瀽xml鏂囦歡鐢熸垚鐨刼rg.apache.catalina.core.StandardServer綾?
5.A connector passes the request and reponse objects to the
Container by calling the Container interface's invoke method
public void invoke(Request request, Response response)
throws IOException, ServletException;
inside the invoke method ,the container loads the servlet class,call
its sevice method ,manage sessions,etc.
2010-4-7
銆恡omcat-socke涓巜orker綰跨▼銆?
/**
* Process an incoming TCP/IP connection on the specified socket.
Any
* exception that occurs during processing must be logged and
swallowed.
* <b>NOTE</b>: This method is called from our
Connector's thread. We
* must assign it to our own thread so that multiple simultaneous
* requests can be handled.
* @param socket TCP socket to process
*/
synchronized void assign(Socket socket) {
// Wait for the Processor to get the previous Socket
while (available) {
try {
wait();
} catch (InterruptedException e) {
}
}
// Store the newly available Socket and notify our thread
this.socket = socket;
available = true;
notifyAll();
}
/**
* Await a newly assigned Socket from our Connector, or
<code>null</code
* if we are supposed to shut down.
*/
private synchronized Socket await() {
// Wait for the Connector to provide a new Socket
while (!available) {
try {
wait();
} catch (InterruptedException e) {
}
}
// Notify the Connector that we have received this Socket
Socket socket = this.socket;
available = false;
notifyAll();
return (socket);
}
榪炴帴鍣ㄧ嚎紼嬭皟鐢╳orker綾葷殑assign綾伙紝worker綾葷殑鎵ц綰跨▼run鏂規硶浼氳皟鐢╝wait鏂規硶鑾峰彇socket錛岄氳繃
available鍙橀噺鐨勮緗拰wait/notify鏂規硶鏉ュ崗璋冨郊姝ょ殑鎿嶄綔銆傚綋榪炴帴鍣ㄧ嚎紼嬫湭浼犺緭socket錛寃orker綾葷嚎紼嬪氨鎵цwait絳夊緟錛?
褰搘orker綾繪墽琛岀嚎紼嬪湪澶勭悊蹇欑殑鏃跺欙紝榪炴帴鍣ㄧ嚎紼媤ait銆?