tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lu...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager StatusTransformer.java
Date Wed, 06 Oct 2004 17:10:25 GMT
luehe       2004/10/06 10:10:25

  Modified:    webapps/docs changelog.xml
               catalina/src/share/org/apache/catalina/core
                        StandardWrapper.java
               webapps/manager/WEB-INF/classes/org/apache/catalina/manager
                        StatusTransformer.java
  Log:
  Register JSP monitoring mbean for each servlet that declares a jsp-file in web.xml
  
  Revision  Changes    Path
  1.141     +4 -1      jakarta-tomcat-catalina/webapps/docs/changelog.xml
  
  Index: changelog.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/docs/changelog.xml,v
  retrieving revision 1.140
  retrieving revision 1.141
  diff -u -r1.140 -r1.141
  --- changelog.xml	6 Oct 2004 13:34:06 -0000	1.140
  +++ changelog.xml	6 Oct 2004 17:10:24 -0000	1.141
  @@ -173,6 +173,9 @@
         <fix>
           <bug>31549</bug>: Add name to WebappClassLoader's stopped message.
(yoavs)
         </fix>
  +      <fix>
  +        Add name to WebappClassLoader's stopped message. (yoavs)
  +      </fix>
       </changelog>
     </subsection>
   
  @@ -205,7 +208,7 @@
           Catalina Connector class. (remm)
         </update>
         <fix>
  -        Fix handling of the "timeout" attribute of the HTTP protocol handler. (remm)
  +        Register JSP monitoring mbean for each servlet that declares a jsp-file in web.xml.
(luehe)
         </fix>
       </changelog>
     </subsection>
  
  
  
  1.50      +6 -9      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.49
  retrieving revision 1.50
  diff -u -r1.49 -r1.50
  --- StandardWrapper.java	6 Oct 2004 00:54:46 -0000	1.49
  +++ StandardWrapper.java	6 Oct 2004 17:10:24 -0000	1.50
  @@ -335,13 +335,10 @@
        */
       public void setJspFile(String jspFile) {
   
  -        //        if ((jspFile != null) && !jspFile.startsWith("/"))
  -        //        throw new IllegalArgumentException
  -        //                (sm.getString("standardWrapper.jspFile.format", jspFile));
  -
           String oldJspFile = this.jspFile;
           this.jspFile = jspFile;
           support.firePropertyChange("jspFile", oldJspFile, this.jspFile);
  +        isJspServlet = true;
   
       }
   
  @@ -1619,9 +1616,10 @@
   
           if (isJspServlet) {
               // Register JSP monitoring mbean
  -            onameStr = domain + ":type=JspMonitor,WebModule=" + webMod +
  -                       ",J2EEApplication=" + ctx.getJ2EEApplication() +
  -                       ",J2EEServer=" + ctx.getJ2EEServer();
  +            onameStr = domain + ":type=JspMonitor,name=" + getName()
  +                       + ",WebModule=" + webMod
  +                       + ",J2EEApplication=" + ctx.getJ2EEApplication()
  +                       + ",J2EEServer=" + ctx.getJ2EEServer();
               try {
                   jspMonitorON = new ObjectName(onameStr);
                   Registry.getRegistry(null, null)
  @@ -1631,7 +1629,6 @@
                            instance);
               }
           }
  -
       }
       
   
  
  
  
  1.24      +19 -12    jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusTransformer.java
  
  Index: StatusTransformer.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/webapps/manager/WEB-INF/classes/org/apache/catalina/manager/StatusTransformer.java,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- StatusTransformer.java	29 Sep 2004 21:11:56 -0000	1.23
  +++ StatusTransformer.java	6 Oct 2004 17:10:25 -0000	1.24
  @@ -590,12 +590,7 @@
               ObjectName queryJspMonitor = new ObjectName
                   (objectName.getDomain() + ":type=JspMonitor,WebModule=" +
                    webModuleName + ",*");
  -            Set jspMonitorsON = mBeanServer.queryNames(queryJspMonitor, null);
  -            ObjectName jspMonitorON = null;
  -            iterator2 = jspMonitorsON.iterator();
  -            while (iterator2.hasNext()) {
  -                jspMonitorON = (ObjectName) iterator2.next();
  -            }
  +            Set jspMonitorONs = mBeanServer.queryNames(queryJspMonitor, null);
   
               // Special case for the root context
               if (contextName.equals("/")) {
  @@ -621,8 +616,8 @@
               if (managerON != null) {
                   writeManager(writer, managerON, mBeanServer, mode);
               }
  -            if (jspMonitorON != null) {
  -                writeJspMonitor(writer, jspMonitorON, mBeanServer, mode);
  +            if (jspMonitorONs != null) {
  +                writeJspMonitor(writer, jspMonitorONs, mBeanServer, mode);
               }
               writer.print("</p>");
   
  @@ -688,17 +683,29 @@
        * Write JSP monitoring information.
        */
       public static void writeJspMonitor(PrintWriter writer,
  -                                       ObjectName objectName,
  +                                       Set jspMonitorONs,
                                          MBeanServer mBeanServer,
                                          int mode)
               throws Exception {
   
  +        int jspCount = 0;
  +        int jspReloadCount = 0;
  +
  +        Iterator iter = jspMonitorONs.iterator();
  +        while (iter.hasNext()) {
  +            ObjectName jspMonitorON = (ObjectName) iter.next();
  +            Object obj = mBeanServer.getAttribute(jspMonitorON, "jspCount");
  +            jspCount += ((Integer) obj).intValue();
  +            obj = mBeanServer.getAttribute(jspMonitorON, "jspReloadCount");
  +            jspReloadCount += ((Integer) obj).intValue();
  +        }
  +
           if (mode == 0) {
               writer.print("<br>");
               writer.print(" JSPs loaded: ");
  -            writer.print(mBeanServer.getAttribute(objectName, "jspCount"));
  +            writer.print(jspCount);
               writer.print(" JSPs reloaded: ");
  -            writer.print(mBeanServer.getAttribute(objectName, "jspReloadCount"));
  +            writer.print(jspReloadCount);
           } else if (mode == 1) {
               // for now we don't write out anything
           }
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message