[jboss-dev-forums] [Design of POJO Server] - Finding RealClassLoader in ServiceDeployer

alesj do-not-reply at jboss.com
Thu Jan 29 04:30:54 EST 2009


There was this fix mentioned here:
 - http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4132644#4132644

I have a patch ready:

  | Index: system-jmx/src/main/org/jboss/system/deployers/ServiceDeployer.java
  | ===================================================================
  | --- system-jmx/src/main/org/jboss/system/deployers/ServiceDeployer.java	(revision 83578)
  | +++ system-jmx/src/main/org/jboss/system/deployers/ServiceDeployer.java	Thu Jan 29 10:12:22 CET 2009
  | @@ -84,13 +84,7 @@
  |        {
  |           ObjectName loaderName = deployment.getClassLoaderName();
  |           if (loaderName == null)
  | -         {
  | -            ClassLoader cl = unit.getClassLoader();
  | -            if (cl != null && cl instanceof RealClassLoader)
  | -               loaderName = ((RealClassLoader) cl).getObjectName();
  | -            else
  | -               loaderName = defaultClassLoader;
  | -         }
  | +            loaderName = findLoaderName(unit.getClassLoader());
  |  
  |           controller.install(deployment, loaderName);
  |           ServiceContext context = controller.getServiceContext(name);
  | @@ -124,6 +118,28 @@
  |        }
  |     }
  |  
  | +   /**
  | +    * Find first RealClassLoader instance
  | +    * and return its ObjectName.
  | +    * If none is found return defaultClassloader.
  | +    *
  | +    * @param cl the classloader
  | +    * @return classloader's ObjectName
  | +    */
  | +   protected ObjectName findLoaderName(ClassLoader cl)
  | +   {
  | +      if (cl == null)
  | +         return defaultClassLoader;
  | +
  | +      if (cl instanceof RealClassLoader)
  | +      {
  | +         RealClassLoader rcl = RealClassLoader.class.cast(cl);
  | +         return rcl.getObjectName();
  | +      }
  | +
  | +      return findLoaderName(cl.getParent());
  | +   }
  | +
  |     public void undeploy(DeploymentUnit unit, ServiceMetaData deployment)
  |     {
  |        ObjectName name = deployment.getObjectName();
  | 

Should I apply it?
Or it might have some strange side affect? :-)

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4205478#4205478

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4205478



More information about the jboss-dev-forums mailing list