[jboss-cvs] JBossAS SVN: r82087 - projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/dependency.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Fri Dec 5 17:32:44 EST 2008


Author: alesj
Date: 2008-12-05 17:32:44 -0500 (Fri, 05 Dec 2008)
New Revision: 82087

Modified:
   projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/dependency/ClassLoadingSpace.java
Log:
Join ifs.

Modified: projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/dependency/ClassLoadingSpace.java
===================================================================
--- projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/dependency/ClassLoadingSpace.java	2008-12-05 22:29:41 UTC (rev 82086)
+++ projects/jboss-cl/branches/Branch_2_0/classloading/src/main/java/org/jboss/classloading/spi/dependency/ClassLoadingSpace.java	2008-12-05 22:32:44 UTC (rev 82087)
@@ -34,12 +34,12 @@
 
 /**
  * ClassLoadingSpace. This class does two stage join/resolve<p>
- * 
+ *
  * join - work out a module's capabilities/requirements and validate they are not inconsistent with what is already there
  * resolve - resolve new requirements and potentially join with other spaces
  * unjoin - remove a module from the space
  * unresolve - work out the new state after a module splits
- * 
+ *
  * TODO JBCL-25 handle split packages
  * @author <a href="adrian at jboss.com">Adrian Brock</a>
  * @version $Revision: 1.1 $
@@ -51,29 +51,29 @@
 
    /** Whether trace is enabled */
    private static boolean trace = log.isTraceEnabled();
-   
+
    /** The modules */
    private Map<Module, Module> modules = new ConcurrentHashMap<Module, Module>();
 
    /** The modules by package */
    private Map<String, Module> modulesByPackage = new ConcurrentHashMap<String, Module>();
-   
+
    /** The requirements for all modules */
    private Map<Module, List<RequirementDependencyItem>> requirements = new ConcurrentHashMap<Module, List<RequirementDependencyItem>>();
-   
+
    /**
     * Get an unmodifiable set of the collections
-    * 
+    *
     * @return the modules
     */
    public Set<Module> getModules()
    {
       return Collections.unmodifiableSet(modules.keySet());
    }
-   
+
    /**
     * Join and resolve a module
-    * 
+    *
     * @param module the module to add
     * @throws IllegalArgumentException for a null module
     */
@@ -83,7 +83,7 @@
          throw new IllegalArgumentException("Null module");
 
       trace = log.isTraceEnabled();
-   
+
       join(module);
       try
       {
@@ -99,10 +99,10 @@
          throw new RuntimeException(modules + " could not join " + this, t);
       }
    }
-   
+
    /**
     * Join with a set of modules
-    * 
+    *
     * @param modules the modules
     * @throws IllegalArgumentException for null modules
     */
@@ -129,7 +129,7 @@
          {
             Module module = entry.getKey();
             ClassLoadingSpace space = entry.getValue();
-            
+
             split(module);
             try
             {
@@ -151,7 +151,7 @@
 
    /**
     * Join with a classloading space
-    * 
+    *
     * @param space the classloading space
     * @throws IllegalArgumentException for null space
     */
@@ -161,19 +161,19 @@
          throw new IllegalArgumentException("Null space");
       if (space == this)
          return;
-      
+
       int ourSize = getModules().size();
       int otherSize = space.getModules().size();
-      
+
       if (ourSize >= otherSize)
          joinAndResolve(space.getModules());
       else
          space.joinAndResolve(getModules());
    }
-   
+
    /**
     * Split with a module
-    * 
+    *
     * @param module the module to remove
     * @throws IllegalArgumentException for a null module
     * @throws IllegalStateException if the module is not associated with this classloading space
@@ -190,10 +190,10 @@
       unjoin(module);
       unresolve(module);
    }
-   
+
    /**
     * Join with a module
-    * 
+    *
     * @param module the module to add
     * @throws IllegalArgumentException for a null module
     */
@@ -205,7 +205,7 @@
       ClassLoadingSpace other = module.getClassLoadingSpace();
       if (other == this)
          return;
-      
+
       if (trace)
          log.trace(module + " joining " + this);
 
@@ -248,37 +248,37 @@
             }
          }
       }
-      
+
       // Update the exported packages
       if (exportedPackages != null && exportedPackages.isEmpty() == false)
       {
          for (String exportedPackage : exportedPackages)
             modulesByPackage.put(exportedPackage, module);
       }
-      
+
       // Remember the module requirements
       if (moduleDependencies != null && moduleDependencies.isEmpty() == false)
          requirements.put(module, moduleDependencies);
-      
+
       // Remove from any previous space
       if (other != null)
          other.split(module);
-      
+
       // This module is now part of our space
       modules.put(module, module);
       module.setClassLoadingSpace(this);
    }
-   
+
    /**
     * Unjoin a module
-    * 
+    *
     * @param module the module to remove
     */
    private void unjoin(Module module)
    {
       if (trace)
          log.trace(module + " unjoining " + this);
-      
+
       // Remove the exported packages for this module
       List<String> packageNames = module.determinePackageNames(false);
       if (packageNames != null)
@@ -293,15 +293,15 @@
 
       // Remove the module requirements from the classloading space
       requirements.remove(module);
-      
+
       // No longer part of this classloading space
       modules.remove(module);
       module.setClassLoadingSpace(null);
    }
-   
+
    /**
     * Resolve a module
-    * 
+    *
     * @param module the module to resolve
     */
    synchronized void resolve(Module module)
@@ -321,27 +321,26 @@
                {
                   // Do we need to join with another classloading space?
                   ClassLoadingSpace space = otherModule.getClassLoadingSpace();
-                  if (space != null)
+                  if (space != null && space != this)
                   {
-                     if (this != space)
-                        space.joinAndResolve(this);
+                     space.joinAndResolve(this);
                   }
                }
             }
          }
       }
    }
-   
+
    /**
     * Unresolve a module
-    * 
+    *
     * @param module the module to resolve
     */
    private void unresolve(Module module)
    {
       if (trace)
          log.trace(module + " unresolving " + this);
-      
+
       // Nothing yet. Could try to split classloading spaces if they now have disjoint subsets?
    }
 }




More information about the jboss-cvs-commits mailing list