[jboss-cvs] JBossAS SVN: r64055 - trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Jul 13 19:07:56 EDT 2007


Author: adrian at jboss.org
Date: 2007-07-13 19:07:56 -0400 (Fri, 13 Jul 2007)
New Revision: 64055

Modified:
   trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
Log:
[JBAS-4206] - Reinstate this hack - missed TODO during the rev of the deployers.

Modified: trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java
===================================================================
--- trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java	2007-07-13 22:39:35 UTC (rev 64054)
+++ trunk/system/src/main/org/jboss/system/server/profileservice/hotdeploy/HDScanner.java	2007-07-13 23:07:56 UTC (rev 64055)
@@ -29,12 +29,15 @@
 import java.util.concurrent.TimeUnit;
 
 import org.jboss.deployers.client.spi.main.MainDeployer;
+import org.jboss.deployers.structure.spi.DeploymentUnit;
+import org.jboss.deployers.structure.spi.main.MainDeployerStructure;
 import org.jboss.deployers.vfs.spi.client.VFSDeployment;
 import org.jboss.kernel.spi.dependency.KernelController;
 import org.jboss.logging.Logger;
 import org.jboss.profileservice.spi.ModificationInfo;
 import org.jboss.profileservice.spi.Profile;
 import org.jboss.profileservice.spi.ProfileService;
+import org.jboss.profileservice.spi.Profile.DeploymentPhase;
 
 
 /**
@@ -283,7 +286,8 @@
             ClassLoader tcl = getTCL(activeProfile);
             try
             {
-               Thread.currentThread().setContextClassLoader(tcl);
+               if (tcl != null)
+                  Thread.currentThread().setContextClassLoader(tcl);
                mainDeployer.process();
                mainDeployer.checkComplete();
             }
@@ -322,18 +326,29 @@
    private ClassLoader getTCL(Profile activeProfile)
       throws Exception
    {
-      ClassLoader tcl = null;
-      /** TODO What is this doing?
-      Collection<DeploymentContext> ctxs = activeProfile.getDeployments(DeploymentPhase.BOOTSTRAP);
-      Iterator<DeploymentContext> iter = ctxs.iterator();
-      while( iter.hasNext() )
+      MainDeployerStructure structure = (MainDeployerStructure) mainDeployer;
+      Collection<VFSDeployment> ctxs = activeProfile.getDeployments(DeploymentPhase.BOOTSTRAP);
+      if (ctxs != null && ctxs.isEmpty() == false)
       {
-         DeploymentContext ctx = iter.next();
-         tcl = ctx.getClassLoader();
-         if( tcl != null )
-            break;
+         for (VFSDeployment deployment : ctxs)
+         {
+            DeploymentUnit unit = structure.getDeploymentUnit(deployment.getName());
+            if (unit != null)
+            {
+               try
+               {
+                  ClassLoader cl = unit.getClassLoader();
+                  if (cl != null)
+                     return cl;
+               }
+               catch (Exception ignored)
+               {
+               }
+            }
+            
+         }
       }
-      */
-      return tcl;
+      log.warn("No bootstrap deployments? profile=" + activeProfile);
+      return null;
    }
 }




More information about the jboss-cvs-commits mailing list