tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader StandardClassLoaderMBean.java StandardClassLoader.java WebappLoader.java mbeans-descriptors.xml
Date Tue, 02 Mar 2004 12:31:57 GMT
remm        2004/03/02 04:31:57

  Modified:    catalina/src/share/org/apache/catalina/loader
                        StandardClassLoader.java WebappLoader.java
                        mbeans-descriptors.xml
  Added:       catalina/src/share/org/apache/catalina/loader
                        StandardClassLoaderMBean.java
  Log:
  - Register all classloaders with JMX, so that Tomcat is actually manageable
    through JMX remote (otherwise, instantiating a new MBean is not possible).
  
  Revision  Changes    Path
  1.8       +2 -2      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java
  
  Index: StandardClassLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/StandardClassLoader.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- StandardClassLoader.java	27 Feb 2004 14:58:44 -0000	1.7
  +++ StandardClassLoader.java	2 Mar 2004 12:31:57 -0000	1.8
  @@ -70,7 +70,7 @@
   
   public class StandardClassLoader
       extends URLClassLoader
  -    implements Reloader {
  +    implements Reloader, StandardClassLoaderMBean {
   
   
       // ----------------------------------------------------------- Constructors
  
  
  
  1.27      +29 -1     jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java
  
  Index: WebappLoader.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/WebappLoader.java,v
  retrieving revision 1.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- WebappLoader.java	27 Feb 2004 14:58:44 -0000	1.26
  +++ WebappLoader.java	2 Mar 2004 12:31:57 -0000	1.27
  @@ -696,6 +696,18 @@
               DirContextURLStreamHandler.bind
                   ((ClassLoader) classLoader, this.container.getResources());
   
  +            StandardContext ctx=(StandardContext)container;
  +            Engine eng=(Engine)ctx.getParent().getParent();
  +            String path = ctx.getPath();
  +            if (path.equals("")) {
  +                path = "/";
  +            }   
  +            ObjectName cloname = new ObjectName
  +                (ctx.getEngineName() + ":type=WebappClassLoader,path="
  +                 + path + ",host=" + ctx.getParent().getName());
  +            Registry.getRegistry(null, null)
  +                .registerComponent(classLoader, cloname, null);
  +
           } catch (Throwable t) {
               log.error( "LifecycleException ", t );
               throw new LifecycleException("start: ", t);
  @@ -731,6 +743,22 @@
           if (classLoader instanceof Lifecycle)
               ((Lifecycle) classLoader).stop();
           DirContextURLStreamHandler.unbind((ClassLoader) classLoader);
  +
  +        try {
  +            StandardContext ctx=(StandardContext)container;
  +            Engine eng=(Engine)ctx.getParent().getParent();
  +            String path = ctx.getPath();
  +            if (path.equals("")) {
  +                path = "/";
  +            }
  +            ObjectName cloname = new ObjectName
  +                (ctx.getEngineName() + ":type=WebappClassLoader,path="
  +                 + path + ",host=" + ctx.getParent().getName());
  +            Registry.getRegistry(null, null).unregisterComponent(cloname);
  +        } catch (Throwable t) {
  +            log.error( "LifecycleException ", t );
  +        }
  +
           classLoader = null;
   
           destroy();
  
  
  
  1.3       +7 -0      jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/mbeans-descriptors.xml
  
  Index: mbeans-descriptors.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/mbeans-descriptors.xml,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- mbeans-descriptors.xml	27 May 2003 23:15:06 -0000	1.2
  +++ mbeans-descriptors.xml	2 Mar 2004 12:31:57 -0000	1.3
  @@ -53,4 +53,11 @@
     </mbean>
   
   
  +  <mbean         name="WebappClassLoader"
  +          description="Classloader implementation which is specialized for
  +                       handling web applications"
  +               domain="Catalina"
  +                group="Loader"
  +                 type="org.apache.catalina.loader.WebappClassLoader" />
  +
   </mbeans-descriptors>
  
  
  
  1.1                  jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/loader/StandardClassLoaderMBean.java
  
  Index: StandardClassLoaderMBean.java
  ===================================================================
  /*
   * Copyright 1999,2004 The Apache Software Foundation.
   * 
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   * 
   *      http://www.apache.org/licenses/LICENSE-2.0
   * 
   * Unless required by applicable law or agreed to in writing, software
   * distributed under the License is distributed on an "AS IS" BASIS,
   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   * See the License for the specific language governing permissions and
   * limitations under the License.
   */
  
  
  package org.apache.catalina.loader;
  
  /**
   * MBean interface for StandardClassLoader, to allow JMX remote management.
   *
   * @author Remy Maucherat
   * @version $Revision: 1.1 $ $Date: 2004/03/02 12:31:57 $
   */
  public interface StandardClassLoaderMBean {
  }
  
  
  
  

---------------------------------------------------------------------
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