[jboss-cvs] JBossAS SVN: r111461 - projects/jboss-jca/branches/performance/perfenv/src/main/java/org/jboss/jca/performance/perfenv.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu May 26 12:37:03 EDT 2011


Author: jesper.pedersen
Date: 2011-05-26 12:37:03 -0400 (Thu, 26 May 2011)
New Revision: 111461

Modified:
   projects/jboss-jca/branches/performance/perfenv/src/main/java/org/jboss/jca/performance/perfenv/Perf.java
Log:
Check both classloader and deployments directory

Modified: projects/jboss-jca/branches/performance/perfenv/src/main/java/org/jboss/jca/performance/perfenv/Perf.java
===================================================================
--- projects/jboss-jca/branches/performance/perfenv/src/main/java/org/jboss/jca/performance/perfenv/Perf.java	2011-05-26 15:56:15 UTC (rev 111460)
+++ projects/jboss-jca/branches/performance/perfenv/src/main/java/org/jboss/jca/performance/perfenv/Perf.java	2011-05-26 16:37:03 UTC (rev 111461)
@@ -29,6 +29,7 @@
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -53,6 +54,12 @@
    /** The home directory */
    private static File home;
 
+   /** The deployments directory */
+   private static File deploymentsRoot;
+
+   /** The installations directory */
+   private static File installationsRoot;
+
    /** The available installations and their root */
    private static Map<String, File> installations;
 
@@ -414,7 +421,18 @@
                deploy.setAccessible(true);
 
                URL url = cl.getResource(deployment);
-               deploy.invoke(active, url);
+
+               if (url == null)
+               {
+                  File f = new File(deploymentsRoot, deployment);
+                  url = f.toURI().toURL();
+               }
+
+               if (url != null)
+                  deploy.invoke(active, url);
+
+               if (url == null)
+                  log.infof("Unable to deploy resource: %s", deployment);
             }
             catch (Throwable t)
             {
@@ -445,7 +463,18 @@
                undeploy.setAccessible(true);
 
                URL url = cl.getResource(deployment);
-               undeploy.invoke(active, url);
+
+               if (url == null)
+               {
+                  File f = new File(deploymentsRoot, deployment);
+                  url = f.toURI().toURL();
+               }
+
+               if (url != null)
+                  undeploy.invoke(active, url);
+
+               if (url == null)
+                  log.infof("Unable to undeploy resource: %s", deployment);
             }
             catch (Throwable t)
             {
@@ -466,11 +495,13 @@
       try
       {
          Profile profile = null;
-         File deploymentsRoot = new File(home, "deployments");
-         File installationsRoot = new File(home, "installations");
 
          // Setup deployment class loader
-         deploymentsClassLoader = new URLClassLoader(getURLs(deploymentsRoot), Perf.class.getClassLoader());
+         URL[] urls = getURLs(deploymentsRoot);
+
+         log.debugf("DeploymentClassLoader: %s", Arrays.toString(urls));
+
+         deploymentsClassLoader = new URLClassLoader(urls, Perf.class.getClassLoader());
          Thread.currentThread().setContextClassLoader(deploymentsClassLoader);
 
          // Init installations
@@ -513,6 +544,9 @@
          home = new File("..");
          System.setProperty("perf.home", home.toURI().toURL().toString());
 
+         deploymentsRoot = new File(home, "deployments");
+         installationsRoot = new File(home, "installations");
+
          String hostname = "localhost";
          int hostport = 7000;
 



More information about the jboss-cvs-commits mailing list