luehe 2004/03/08 08:51:07
Modified: jasper2/src/share/org/apache/jasper/compiler
JspRuntimeContext.java
jasper2/src/share/org/apache/jasper/servlet JspServlet.java
Log:
Added JSP monitoring facility.
Initially, the number of JSPs that have been loaded into a webapp is exposed
as a monitorable attribute. Additional attributes (e.g., number of JSPs whose
compilation failed, etc.) may follow.
Revision Changes Path
1.20 +14 -4
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java
Index: JspRuntimeContext.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/compiler/JspRuntimeContext.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- JspRuntimeContext.java 5 Feb 2004 23:02:18 -0000 1.19
+++ JspRuntimeContext.java 8 Mar 2004 16:51:07 -0000 1.20
@@ -243,6 +243,16 @@
}
/**
+ * Returns the number of JSPs for which JspServletWrappers exist, i.e.,
+ * the number of JSPs that have been loaded into the webapp.
+ *
+ * @return The number of JSPs that have been loaded into the webapp
+ */
+ public int getJspCount() {
+ return jsps.size();
+ }
+
+ /**
* Get the SecurityManager Policy CodeSource for this web
* applicaiton context.
*
1.33 +26 -7
jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java
Index: JspServlet.java
===================================================================
RCS file:
/home/cvs/jakarta-tomcat-jasper/jasper2/src/share/org/apache/jasper/servlet/JspServlet.java,v
retrieving revision 1.32
retrieving revision 1.33
diff -u -r1.32 -r1.33
--- JspServlet.java 3 Feb 2004 17:31:40 -0000 1.32
+++ JspServlet.java 8 Mar 2004 16:51:07 -0000 1.33
@@ -72,6 +72,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.apache.jasper.Constants;
import org.apache.jasper.EmbeddedServletOptions;
import org.apache.jasper.Options;
@@ -104,16 +105,18 @@
private Options options;
private JspRuntimeContext rctxt;
- public void init(ServletConfig config)
- throws ServletException {
+
+ /*
+ * Initializes this JspServlet.
+ */
+ public void init(ServletConfig config) throws ServletException {
super.init(config);
this.config = config;
this.context = config.getServletContext();
-
- options = new EmbeddedServletOptions(config, context);
// Initialize the JSP Runtime Context
+ options = new EmbeddedServletOptions(config, context);
rctxt = new JspRuntimeContext(context,options);
if (log.isDebugEnabled()) {
@@ -125,6 +128,21 @@
/**
+ * Returns the number of JSPs for which JspServletWrappers exist, i.e.,
+ * the number of JSPs that have been loaded into the webapp with which
+ * this JspServlet is associated.
+ *
+ * This info may be used for monitoring purposes.
+ *
+ * @return The number of JSPs that have been loaded into the webapp with
+ * which this JspServlet is associated
+ */
+ public int getJspCount() {
+ return this.rctxt.getJspCount();
+ }
+
+
+ /**
* <p>Look for a <em>precompilation request</em> as described in
* Section 8.4.2 of the JSP 1.2 Specification. <strong>WARNING</strong> -
* we cannot use <code>request.getParameter()</code> for this, because
@@ -262,6 +280,7 @@
if (log.isDebugEnabled()) {
log.debug("JspServlet.destroy()");
}
+
rctxt.destroy();
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]