Return-Path: Delivered-To: apmail-jakarta-tomcat-dev-archive@www.apache.org Received: (qmail 50923 invoked from network); 8 Mar 2004 16:52:54 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 8 Mar 2004 16:52:54 -0000 Received: (qmail 84793 invoked by uid 500); 8 Mar 2004 16:52:41 -0000 Delivered-To: apmail-jakarta-tomcat-dev-archive@jakarta.apache.org Received: (qmail 84670 invoked by uid 500); 8 Mar 2004 16:52:41 -0000 Mailing-List: contact tomcat-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Tomcat Developers List" Reply-To: "Tomcat Developers List" Delivered-To: mailing list tomcat-dev@jakarta.apache.org Received: (qmail 84656 invoked by uid 500); 8 Mar 2004 16:52:41 -0000 Received: (qmail 84653 invoked from network); 8 Mar 2004 16:52:40 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 8 Mar 2004 16:52:40 -0000 Received: (qmail 50869 invoked by uid 1399); 8 Mar 2004 16:52:46 -0000 Date: 8 Mar 2004 16:52:46 -0000 Message-ID: <20040308165246.50868.qmail@minotaur.apache.org> From: luehe@apache.org To: jakarta-tomcat-catalina-cvs@apache.org Subject: cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/core StandardWrapper.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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