You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by lu...@apache.org on 2002/11/16 05:20:10 UTC

cvs commit: jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime TagHandlerPool.java

luehe       2002/11/15 20:20:10

  Modified:    jasper2/src/share/org/apache/jasper Constants.java
                        EmbededServletOptions.java JspC.java Options.java
               jasper2/src/share/org/apache/jasper/compiler Generator.java
                        ServletWriter.java
               jasper2/src/share/org/apache/jasper/resources
                        messages.properties
               jasper2/src/share/org/apache/jasper/runtime
                        TagHandlerPool.java
  Log:
  Added init param to configure tag pool size.
  
  Revision  Changes    Path
  1.9       +7 -0      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java
  
  Index: Constants.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Constants.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Constants.java	20 Sep 2002 18:06:38 -0000	1.8
  +++ Constants.java	16 Nov 2002 04:20:09 -0000	1.9
  @@ -138,6 +138,13 @@
       public static final int DEFAULT_TAG_BUFFER_SIZE = 512;
   
       /**
  +     * Default tag handler pool size.
  +     */
  +    public static final int MAX_POOL_SIZE = 5;
  +    public static final Integer MAX_POOL_SIZE_INTEGER
  +	= new Integer(MAX_POOL_SIZE);
  +
  +    /**
        * The query parameter that causes the JSP engine to just
        * pregenerated the servlet but not invoke it. 
        */
  
  
  
  1.12      +42 -10    jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java
  
  Index: EmbededServletOptions.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/EmbededServletOptions.java,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -r1.11 -r1.12
  --- EmbededServletOptions.java	22 Oct 2002 22:23:14 -0000	1.11
  +++ EmbededServletOptions.java	16 Nov 2002 04:20:09 -0000	1.12
  @@ -105,7 +105,12 @@
       /**
        * Determines whether tag handler pooling is enabled.
        */
  -    private boolean poolingEnabled = true;
  +    private boolean isPoolingEnabled = true;
  +
  +     /**
  +      * Tag handler pool size.
  +      */
  +    private int tagPoolSize;
       
       /**
        * Do you want support for "mapped" files? This will generate
  @@ -198,7 +203,14 @@
       }
       
       public boolean isPoolingEnabled() {
  -	return poolingEnabled;
  +	return isPoolingEnabled;
  +    }
  +
  +    /**
  +     * Returns the tag handler pool size.
  +     */
  +    public int getTagPoolSize() {
  +	return tagPoolSize;
       }
   
       /**
  @@ -293,12 +305,15 @@
        * Create an EmbededServletOptions object using data available from
        * ServletConfig and ServletContext. 
        */
  -    public EmbededServletOptions(ServletConfig config, ServletContext context) {
  +    public EmbededServletOptions(ServletConfig config,
  +				 ServletContext context) {
  +
  +	this.tagPoolSize = Constants.MAX_POOL_SIZE;
  +
           Enumeration enum=config.getInitParameterNames();
           while( enum.hasMoreElements() ) {
               String k=(String)enum.nextElement();
               String v=config.getInitParameter( k );
  -
               setProperty( k, v);
           }
   
  @@ -325,17 +340,34 @@
               else Constants.message ("jsp.warning.largeFile", Logger.WARNING);
           }
   	
  -	poolingEnabled = true;
  +	this.isPoolingEnabled = true;
           String poolingEnabledParam
   	    = config.getInitParameter("enablePooling"); 
           if (poolingEnabledParam != null
     	        && !poolingEnabledParam.equalsIgnoreCase("true")) {
               if (poolingEnabledParam.equalsIgnoreCase("false"))
  -                this.poolingEnabled = false;
  +                this.isPoolingEnabled = false;
               else Constants.message("jsp.warning.enablePooling",
   				   Logger.WARNING);
           }
   
  +        String tagPoolSizeParam = config.getInitParameter("tagPoolSize");
  +        if (tagPoolSizeParam != null) {
  +            try {
  +                this.tagPoolSize = Integer.parseInt(tagPoolSizeParam);
  +                if (this.tagPoolSize <= 0) {
  +                    this.tagPoolSize = Constants.MAX_POOL_SIZE;
  +                    Constants.message("jsp.warning.invalidTagPoolSize",
  +				      new Object[] { Constants.MAX_POOL_SIZE_INTEGER },
  +                                      Logger.WARNING);
  +                }
  +            } catch(NumberFormatException ex) {
  +                Constants.message("jsp.warning.invalidTagPoolSize",
  +				  new Object[] { Constants.MAX_POOL_SIZE_INTEGER },
  +				  Logger.WARNING);
  +            }
  +        }
  +
           String mapFile = config.getInitParameter("mappedfile"); 
           if (mapFile != null) {
               if (mapFile.equalsIgnoreCase("true"))
  @@ -366,7 +398,7 @@
           String checkInterval = config.getInitParameter("checkInterval");
           if (checkInterval != null) {
               try {
  -                this.checkInterval = new Integer(checkInterval).intValue();
  +		this.checkInterval = Integer.parseInt(checkInterval);
                   if (this.checkInterval == 0) {
                       this.checkInterval = 300;
                       Constants.message("jsp.warning.checkInterval",
  
  
  
  1.18      +7 -3      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java
  
  Index: JspC.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/JspC.java,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- JspC.java	6 Nov 2002 19:26:31 -0000	1.17
  +++ JspC.java	16 Nov 2002 04:20:09 -0000	1.18
  @@ -213,6 +213,10 @@
           return true;
       }
   
  +    public int getTagPoolSize() {
  +	return Constants.MAX_POOL_SIZE;
  +    }
  +
       /**
        * Are we supporting HTML mapped servlets?
        */
  
  
  
  1.9       +8 -3      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java
  
  Index: Options.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/Options.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- Options.java	20 Aug 2002 03:52:18 -0000	1.8
  +++ Options.java	16 Nov 2002 04:20:09 -0000	1.9
  @@ -93,6 +93,11 @@
        */
       public boolean isPoolingEnabled();
   
  +     /**
  +      * Returns the size used by all tag handler pools.
  +      */
  +    public int getTagPoolSize();
  +
       /**
        * Are we supporting HTML mapped servlets?
        */
  
  
  
  1.127     +6 -4      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java
  
  Index: Generator.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/Generator.java,v
  retrieving revision 1.126
  retrieving revision 1.127
  diff -u -r1.126 -r1.127
  --- Generator.java	15 Nov 2002 19:41:28 -0000	1.126
  +++ Generator.java	16 Nov 2002 04:20:10 -0000	1.127
  @@ -659,7 +659,9 @@
   	out.pushIndent();
   	for (int i=0; i<tagHandlerPoolNames.size(); i++) {
   	    out.printin((String) tagHandlerPoolNames.elementAt(i));
  -	    out.println(" = new org.apache.jasper.runtime.TagHandlerPool();");
  +	    out.print(" = new org.apache.jasper.runtime.TagHandlerPool(");
  +            out.print(ctxt.getOptions().getTagPoolSize());
  +            out.println(");");
   	}
   	out.popIndent();
   	out.printil("}");
  
  
  
  1.2       +10 -3     jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ServletWriter.java
  
  Index: ServletWriter.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/ServletWriter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ServletWriter.java	28 Mar 2002 18:46:16 -0000	1.1
  +++ ServletWriter.java	16 Nov 2002 04:20:10 -0000	1.2
  @@ -186,6 +186,13 @@
       }
   
       /**
  +     * Prints the given int.
  +     */
  +    public void print(int i) {
  +	writer.print(i);
  +    }
  +
  +    /**
        * Prints the given string.
        *
        * The string must not contain any '\n', otherwise the line count will be
  
  
  
  1.60      +2 -1      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties
  
  Index: messages.properties
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/resources/messages.properties,v
  retrieving revision 1.59
  retrieving revision 1.60
  diff -u -r1.59 -r1.60
  --- messages.properties	16 Nov 2002 04:02:18 -0000	1.59
  +++ messages.properties	16 Nov 2002 04:20:10 -0000	1.60
  @@ -121,6 +121,7 @@
   jsp.warning.keepgen=Warning: Invalid value for the initParam keepgenerated. Will use the default value of \"false\"
   jsp.warning.largeFile=Warning: Invalid value for the initParam largeFile. Will use the default value of \"true\"
   jsp.warning.enablePooling=Warning: Invalid value for the initParam enablePooling. Will use the default value of \"true\"
  +jsp.warning.invalidTagPoolSize=Warning: Invalid value for the init parameter named tagPoolSize. Will use default size of {0}
   jsp.warning.mappedFile=Warning: Invalid value for the initParam mappedFile. Will use the default value of \"false\"
   jsp.warning.sendErrToClient=Warning: Invalid value for the initParam sendErrToClient. Will use the default value of \"false\"
   jsp.warning.classDebugInfo=Warning: Invalid value for the initParam classdebuginfo. Will use the default value of \"false\"
  
  
  
  1.3       +5 -6      jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/TagHandlerPool.java
  
  Index: TagHandlerPool.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/runtime/TagHandlerPool.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TagHandlerPool.java	26 Jul 2002 23:21:39 -0000	1.2
  +++ TagHandlerPool.java	16 Nov 2002 04:20:10 -0000	1.3
  @@ -63,6 +63,7 @@
   
   import javax.servlet.jsp.JspException;
   import javax.servlet.jsp.tagext.Tag;
  +import org.apache.jasper.Constants;
   
   /**
    * Pool of tag handlers that can be reused.
  @@ -70,8 +71,6 @@
    * @author Jan Luehe
    */
   public class TagHandlerPool {
  -    
  -    private static final int MAX_POOL_SIZE = 5;
   
       private Tag[] handlers;
   
  @@ -82,7 +81,7 @@
        * Constructs a tag handler pool with the default capacity.
        */
       public TagHandlerPool() {
  -	this(MAX_POOL_SIZE);
  +	this(Constants.MAX_POOL_SIZE);
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>