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 2004/03/08 17:52:46 UTC
cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardWrapper.java
luehe 2004/03/08 08:52:46
Modified: catalina/src/share/org/apache/catalina/core
StandardWrapper.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.38 +52 -13 jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java
Index: StandardWrapper.java
===================================================================
RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core/StandardWrapper.java,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -r1.37 -r1.38
--- StandardWrapper.java 27 Feb 2004 14:58:42 -0000 1.37
+++ StandardWrapper.java 8 Mar 2004 16:52:46 -0000 1.38
@@ -219,6 +219,18 @@
/**
+ * True if this StandardWrapper is for the JspServlet
+ */
+ private boolean isJspServlet;
+
+
+ /**
+ * The ObjectName of the JSP monitoring mbean
+ */
+ private ObjectName jspMonitorON;
+
+
+ /**
* Should we swallow System.out
*/
private boolean swallowOutput = false;
@@ -502,7 +514,9 @@
this.servletClass = servletClass;
support.firePropertyChange("servletClass", oldServletClass,
this.servletClass);
-
+ if (Constants.JSP_SERVLET_CLASS.equals(servletClass)) {
+ isJspServlet = true;
+ }
}
@@ -1571,21 +1585,30 @@
sequenceNumber++);
broadcaster.sendNotification(notification);
}
+
+ if (isJspServlet && jspMonitorON != null ) {
+ Registry.getRegistry(null, null).unregisterComponent(jspMonitorON);
+ }
+
}
protected void registerJMX(StandardContext ctx) {
+
+ String parentName = ctx.getName();
+ parentName = ("".equals(parentName)) ? "/" : parentName;
+
+ String hostName = ctx.getParent().getName();
+ hostName = (hostName==null) ? "DEFAULT" : hostName;
+
+ String domain = ctx.getDomain();
+
+ String webMod= "//" + hostName + parentName;
+ String onameStr = domain + ":j2eeType=Servlet,name=" + getName() +
+ ",WebModule=" + webMod + ",J2EEApplication=" +
+ ctx.getJ2EEApplication() + ",J2EEServer=" +
+ ctx.getJ2EEServer();
+
try {
- // it should be full name
- String parentName=ctx.getName();
- String hostName=ctx.getParent().getName();
- String webMod= "//" + ((hostName==null)? "DEFAULT" :hostName ) +
- (("".equals(parentName) ) ? "/" : parentName );
- String onameStr=ctx.getDomain() +
- ":j2eeType=Servlet,name=" + getName() + ",WebModule=" +
- webMod + ",J2EEApplication=" +
- ctx.getJ2EEApplication() + ",J2EEServer=" +
- ctx.getJ2EEServer();
-
oname=new ObjectName(onameStr);
controller=oname;
Registry.getRegistry(null, null)
@@ -1602,6 +1625,22 @@
} catch( Exception ex ) {
log.info("Error registering servlet with jmx " + this);
}
+
+ if (isJspServlet) {
+ // Register JSP monitoring mbean
+ try {
+ jspMonitorON = new ObjectName(domain +
+ " :type=JspMonitor,path=" +
+ parentName + ",host=" +
+ hostName);
+ Registry.getRegistry(null, null)
+ .registerComponent(instance, jspMonitorON, null);
+ } catch( Exception ex ) {
+ log.info("Error registering JSP monitoring with jmx " +
+ instance);
+ }
+ }
+
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org