tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From go...@hyperreal.org
Subject cvs commit: jakarta-tomcat/src/share/org/apache/tomcat/core Context.java
Date Mon, 25 Oct 1999 22:06:43 GMT
gonzo       99/10/25 15:06:42

  Modified:    src/share/org/apache/tomcat/core Tag: TOMCAT_J2EE_10F_102199
                        Context.java
  Log:
  order the "load on startup" servlet keys - j2ee
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.5.2.1   +43 -28    jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java
  
  Index: Context.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v
  retrieving revision 1.5
  retrieving revision 1.5.2.1
  diff -u -r1.5 -r1.5.2.1
  --- Context.java	1999/10/20 11:23:46	1.5
  +++ Context.java	1999/10/25 22:06:35	1.5.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v 1.5
1999/10/20 11:23:46 akv Exp $
  - * $Revision: 1.5 $
  - * $Date: 1999/10/20 11:23:46 $
  + * $Header: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Context.java,v 1.5.2.1
1999/10/25 22:06:35 gonzo Exp $
  + * $Revision: 1.5.2.1 $
  + * $Date: 1999/10/25 22:06:35 $
    *
    * ====================================================================
    *
  @@ -913,41 +913,56 @@
       }
   
       private void loadServlets() {
  -	Vector loadServlets = new Vector();
  +	Vector orderedKeys = new Vector();
   	Enumeration e = loadableServlets.keys();
  +	
  +	// order keys
   
   	while (e.hasMoreElements()) {
   	    Integer key = (Integer)e.nextElement();
  -	    Vector v = (Vector)loadableServlets.get(key);
  -	    Enumeration lse = v.elements();
  +	    int slot = -1;
  +
  +	    for (int i = 0; i < orderedKeys.size(); i++) {
  +	        if (key.intValue() <
  +		    ((Integer)(orderedKeys.elementAt(i))).intValue()) {
  +		    slot = i;
  +
  +		    break;
  +		}
  +	    }
   
  -	    while (lse.hasMoreElements()) {
  -	        loadServlets.addElement(lse.nextElement());
  +	    if (slot > -1) {
  +	        orderedKeys.insertElementAt(key, slot);
  +	    } else {
  +	        orderedKeys.addElement(key);
   	    }
   	}
   
  -        // Changed because this is exactly opposite of what we want....
  -        // Servlets were being loaded in the exact opposite order.
  -        // Priorities IMO, should start with 0.
  -        // Only System Servlets should be at 0 and rest of the servlets
  -        // should be +ve integers.
  -        // WARNING: Please do not change this without talking to:
  -        // harishp@eng.sun.com (J2EE impact)
  -	// for (int i = loadServlets.size() - 1; i >= 0; i--) {
  -
  -	for(int i = 0; i < loadServlets.size(); ++i) {
  -            String servletName = (String)loadServlets.elementAt(i);
  -	    LookupResult result =
  -	        container.lookupServletByName(servletName);
  +	// loaded ordered servlets
   
  -	    try {
  -	        result.getWrapper().loadServlet(); 
  -	    } catch (Exception ee) {
  -		ee.printStackTrace();
  -	        String msg = sm.getString("context.loadServlet.e",
  -		    servletName);
  +	// Priorities IMO, should start with 0.
  +	// Only System Servlets should be at 0 and rest of the
  +	// servlets should be +ve integers.
  +	// WARNING: Please do not change this without talking to:
  +	// harishp@eng.sun.com (J2EE impact)
  +
  +	for (int i = 0; i < orderedKeys.size(); i ++) {
  +	    Integer key = (Integer)orderedKeys.elementAt(i);
  +	    e = ((Vector)(loadableServlets.get(key))).elements();
  +
  +	    while (e.hasMoreElements()) {
  +		String servletName = (String)e.nextElement();
  +		LookupResult result =
  +		    container.lookupServletByName(servletName);
   
  -	        System.out.println(msg);
  +		try {
  +		    result.getWrapper().loadServlet();
  +		} catch (Exception ee) {
  +		    String msg = sm.getString("context.loadServlet.e",
  +		        servletName);
  +
  +		    System.out.println(msg);
  +		} 
   	    }
   	}
       }
  
  
  

Mime
View raw message