Enginetomcat engineÊÇÒ»¸öÍêÕûµÄServletÈÝÆ÷£¬ÆäÏÂÃæÓµÓжà¸öÐéÄâÖ÷»ú£¬ËüµÄÔðÈξÍÊǽ«Óû§ÇëÇó·ÖÅä¸øÒ»¸öÐéÄâÉÏ»ú´¦Àí¡£½Ó¿ÚEngine´ú±íÒ»¸öServletÒýÇ棬ÆäʵÏÖÀàÊÇStandardEngine£¬ÏÈÀ´¿´¿´¹¹Ôì·½·¨
-
public StandardEngine() {
-
-
super();
-
pipeline.setBasic(new StandardEngineValve());
-
/* Set the jmvRoute using the system property jvmRoute */
-
try {
-
setJvmRoute(System.getProperty("jvmRoute"));
-
} catch(Exception ex) {
-
log.warn(sm.getString("standardEngine.jvmRouteFail"));
-
}
-
// By default, the engine will hold the reloading thread
-
backgroundProcessorDelay = 10;
-
-
}
Õâ¸ö·½·¨ÔÚDigester½âÎöServer.xmlʱ»áµ÷Óã¬ËüÊ×ÏÈÉèÖÃÒ»¸ö»ù±¾·§ÃÅ£¬È»ºóÉèÖÃJVMRoute£¬Õâ¸öÔÚclusterÖлáÓõ½£¬È»ºóΪbackgroundProcessorDelay¸³³õÖµ£¬backgroundProcessorDelayµÄº¬ÒåÔÚÇ°ÃæÓн²¹ý¡£
À´¿´¿´Õâ¸ö»ù±¾·§ÃÅ(StandardEngineValve)×öÁËÄÄЩÊÂ,ÕâÀïÃæ×îÖØÒªµÄÊÇËüµÄinvoke·½·¨
-
public final void invoke(Request request, Response response)
-
throws IOException, ServletException {
-
-
// Select the Host to be used for this Request
-
Host host = request.getHost();
-
if (host == null) {
-
response.sendError
-
(HttpServletResponse.SC_BAD_REQUEST,
-
sm.getString("standardEngine.noHost",
-
request.getServerName()));
-
return;
-
}
-
if (request.isAsyncSupported()) {
-
request.setAsyncSupported(host.getPipeline().isAsyncSupported());
-
}
-
-
// Ask this Host to process this request
-
host.getPipeline().getFirst().invoke(request, response);
-
-
}
Ö»×öÁËÁ½¼þÊ£º
(1)Ñ¡ÔñÒ»¸öÖ÷»úÀ´´¦ÀíÓû§ÇëÇó
(2)Èç¹ûÇëÇóÊÇÒì²½µÄ£¬ÉèÖÃÒì²½±ê־λ
ÖÁÓÚÒýÇæµÄ³õʼ»¯ºÍÆô¶¯ºÜ¼òµ¥£¬Ç°ÃæÓн²¹ýServiceµÄ³õʼ»¯»áÏȳõʼ»¯ÈÝÆ÷£¬ÔÙ³õʼ»¯Á¬½ÓÆ÷¡£¶ÔÈÝÆ÷µÄ³õʼ»¯Ê×ÏȾͻá³õʼ»¯¶¥¼¶ÈÝÆ÷£¬Ò²¾ÍÊÇengine,ÒýÇæµÄÆô¶¯Ò²ÊÇÔÚServiceµÄÆô¶¯ÖÐÍê³ÉµÄ¡£¶ÔÓÚÈÝÆ÷µÄÕû¸ö³õʼ»¯ºÍÆô¶¯¹ý³Ìµ½Ê±»áµ¥¶À·ÖÎö¡£
À´¿´¿´engineµÄÅäÖÃ
-
<Engine name="Catalina" defaultHost="localhost">
-
<Realm className="org.apache.catalina.realm.LockOutRealm">
-
<Realm className="org.apache.catalina.realm.UserDatabaseRealm"
-
resourceName="UserDatabase"/>
-
</Realm>
-
-
<Host name="localhost" appBase="webapps" unpackWARs="true" autoDeploy="true">
-
<Valve className="org.apache.catalina.valves.AccessLogValve" directory="logs"
-
prefix="localhost_access_log." suffix=".txt"
-
pattern="%h %l %u %t "%r" %s %b" resolveHosts="false"/>
-
-
</Host>
-
</Engine>
nameÊôÐÔÊÇÒýÇæµÄÂß¼Ãû³Æ£¬ÔÚÈÕÖ¾ºÍ´íÎóÏûÏ¢ÖлáÓõ½£¬ÔÚͬһ̨·þÎñÆ÷ÉÏÓжà¸öServiceʱ£¬name±ØÐëΨһ¡£
defaultHostÖ¸¶¨Ä¬ÈÏÖ÷»ú£¬Èç¹ûûÓзÖÅäÄĸöÖ÷»úÀ´Ö´ÐÐÓû§ÇëÇó£¬ÓÉÕâ¸öÖµËùÖ¸¶¨µÄÖ÷»úÀ´´¦Àí£¬Õâ¸öÖµ±ØÐëºÍ<Host>ÔªËØÖеÄÆäÖÐÒ»¸öÏàͬ¡£
EngineÀïÃæ³ýÁË¿ÉÒÔÖ¸¶¨ÊôÐÔÖ®Í⣬»¹¿ÉÒÔÓÐÆäËü×é¼þ£¬±ÈÈ磺log,listener,filter,realmµÈ,ºóÃæ»áµ¥¶À·ÖÎö.
(ÔðÈα༣ºIT) |