costin 01/04/21 12:54:35
Modified: src/facade22/org/apache/tomcat/facade JspInterceptor.java
src/share/org/apache/jasper/runtime JspFactoryImpl.java
Log:
Fix for 1416. ( reported by [EMAIL PROTECTED] ).
The pool size for jsps is configurable ( starting next nightly of 3.3 ).
Revision Changes Path
1.20 +11 -1
jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java
Index: JspInterceptor.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/facade22/org/apache/tomcat/facade/JspInterceptor.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- JspInterceptor.java 2001/04/04 17:49:55 1.19
+++ JspInterceptor.java 2001/04/21 19:54:34 1.20
@@ -214,6 +214,14 @@
args.put( "jspCompilerPlugin", type );
}
+ int pageContextPoolSize=JspFactoryImpl.DEFAULT_POOL_SIZE;
+ /** Set the PageContext pool size for jasper factory.
+ 0 will disable pooling of PageContexts.
+ */
+ public void setPageContextPoolSize(int i) {
+ pageContextPoolSize=i;
+ }
+
// -------------------- Hooks --------------------
/**
@@ -222,7 +230,9 @@
public void addContext(ContextManager cm, Context ctx)
throws TomcatException
{
- JspFactory.setDefaultFactory(new JspFactoryImpl());
+ JspFactoryImpl factory=new JspFactoryImpl(pageContextPoolSize);
+
+ JspFactory.setDefaultFactory(factory);
// jspServlet uses it's own loader. We need to add workdir
// to the context classpath to use URLLoader and normal
1.13 +21 -5
jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java
Index: JspFactoryImpl.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -r1.12 -r1.13
--- JspFactoryImpl.java 2001/03/31 22:30:38 1.12
+++ JspFactoryImpl.java 2001/04/21 19:54:34 1.13
@@ -1,7 +1,7 @@
/*
- * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v
1.12 2001/03/31 22:30:38 costin Exp $
- * $Revision: 1.12 $
- * $Date: 2001/03/31 22:30:38 $
+ * $Header:
/home/cvs/jakarta-tomcat/src/share/org/apache/jasper/runtime/JspFactoryImpl.java,v
1.13 2001/04/21 19:54:34 costin Exp $
+ * $Revision: 1.13 $
+ * $Date: 2001/04/21 19:54:34 $
*
* ====================================================================
*
@@ -78,8 +78,9 @@
* @author Anil K. Vijendran
*/
public class JspFactoryImpl extends JspFactory {
- private SimplePool pool=new SimplePool( 100 );
- private static final boolean usePool=true;
+ public static final int DEFAULT_POOL_SIZE=100;
+ private SimplePool pool;
+ private boolean usePool=true;
static String lineSeparator;
static {
try {
@@ -92,7 +93,22 @@
// without it we would need a priviledged action.
JspWriterImpl.lineSeparator=lineSeparator;
}
+
+ public JspFactoryImpl() {
+ pool=new SimplePool( DEFAULT_POOL_SIZE );
+ usePool=true;
+ }
+
+ public JspFactoryImpl( int size ) {
+ if( size==0 ) {
+ pool=null;
+ usePool=false;
+ } else {
+ pool=new SimplePool( size );
+ }
+ }
+
Log loghelper = Log.getLog("JASPER_LOG", "JspFactoryImpl");
public PageContext getPageContext(Servlet servlet, ServletRequest request,