geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject svn commit: r764311 - in /geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config: ./ classloading/
Date Sun, 12 Apr 2009 18:31:28 GMT
Author: djencks
Date: Sun Apr 12 18:31:28 2009
New Revision: 764311

URL: http://svn.apache.org/viewvc?rev=764311&view=rev
Log:
remove unused classloader parent mutability.  Add a little error checking

Removed:
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/classloading/GlobalClassLoaderListener.java
Modified:
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
    geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/classloading/GlobalClassLoader.java

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java?rev=764311&r1=764310&r2=764311&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/ConfigurationResolver.java
Sun Apr 12 18:31:28 2009
@@ -68,6 +68,9 @@
     public ConfigurationResolver(ConfigurationData configurationData, Collection<? extends
Repository> repositories, ArtifactResolver artifactResolver) {
         if (configurationData == null)  throw new NullPointerException("configurationData
is null");
         if (repositories == null) repositories = Collections.emptySet();
+        for (Repository repo: repositories) {
+            if (repo == null) throw new NullPointerException("null repository");
+        }
 
         configurationId = configurationData.getId();
         this.artifactResolver = artifactResolver;

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java?rev=764311&r1=764310&r2=764311&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/SimpleConfigurationManager.java
Sun Apr 12 18:31:28 2009
@@ -78,7 +78,13 @@
                                       Collection<DeploymentWatcher> watchers) {
         if (stores == null) stores = Collections.emptySet();
         if (repositories == null) repositories = Collections.emptySet();
+        for (Repository repo: repositories) {
+            if (repo == null) throw new NullPointerException("null repository");
+        }
         if (watchers == null) watchers = Collections.emptySet();
+        for (DeploymentWatcher watcher: watchers) {
+            if (watcher == null) throw new NullPointerException("null DeploymentWatcher");
+        }
 
         this.stores = stores;
         this.artifactResolver = artifactResolver;

Modified: geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/classloading/GlobalClassLoader.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/classloading/GlobalClassLoader.java?rev=764311&r1=764310&r2=764311&view=diff
==============================================================================
--- geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/classloading/GlobalClassLoader.java
(original)
+++ geronimo/sandbox/djencks/framework/modules/geronimo-kernel/src/main/java/org/apache/geronimo/kernel/config/classloading/GlobalClassLoader.java
Sun Apr 12 18:31:28 2009
@@ -41,14 +41,12 @@
  *
  * @version $Rev: 732599 $ $Date: 2009-01-08 14:36:25 +1100 (Thu, 08 Jan 2009) $
  */
-public class GlobalClassLoader extends URLClassLoader implements GlobalClassLoaderListener
{
+public class GlobalClassLoader extends URLClassLoader {
     private static final Logger LOG = LoggerFactory.getLogger(GlobalClassLoader.class);
 
     private final Artifact artifact;
     private final Set<Artifact> dependencies;
-    private final CopyOnWriteArraySet<GlobalClassLoaderListener> listeners = new CopyOnWriteArraySet<GlobalClassLoaderListener>();
     private final CopyOnWriteArraySet<String> resourcesNotFound = new CopyOnWriteArraySet<String>();
-    private final CopyOnWriteArraySet<GlobalClassLoader> flattenedParents = new CopyOnWriteArraySet<GlobalClassLoader>();
     private ClassLoader[] parents;
 
     public GlobalClassLoader(Artifact artifact, URL[] urls, ClassLoader[] parents) {
@@ -58,55 +56,9 @@
         dependencies = Collections.emptySet();
     }
 
-    public GlobalClassLoader(Artifact artifact, URL[] urls, Set<Artifact> dependencies)
{
-        super(urls);
-        if (null == dependencies) {
-            throw new IllegalArgumentException("dependencies is required");
-        }
-        this.artifact = artifact;
-        this.dependencies = dependencies;
-
-        parents = new ClassLoader[] { ClassLoader.getSystemClassLoader() };
-    }
-    
     public Artifact getArtifact() {
         return artifact;
     }
-
-    public synchronized void registerListener(GlobalClassLoaderListener listener) {
-        listeners.add(listener);
-        
-        for (GlobalClassLoader classLoader : flattenedParents) {
-            listener.notifyAddParent(this, classLoader);
-        }
-    }
-    
-    public synchronized void notifyAddParent(GlobalClassLoader globalClassLoader, GlobalClassLoader
parent) {
-        flattenedParents.add(parent);
-        
-        for (GlobalClassLoaderListener listener : listeners) {
-            listener.notifyAddParent(globalClassLoader, parent);
-        }
-    }
-
-    public synchronized void addParent(ClassLoader parent) {
-        for (ClassLoader parentClassLoader : parents) {
-            if (parentClassLoader == parent) {
-                return;
-            }
-        }
-        
-        ClassLoader[] newParents = new ClassLoader[parents.length + 1];
-        System.arraycopy(parents, 0, newParents, 0, parents.length);
-        newParents[parents.length] = parent;
-        parents = newParents;
-        
-        if (parent instanceof GlobalClassLoader) {
-            for (GlobalClassLoaderListener listener : listeners) {
-                listener.notifyAddParent(this, (GlobalClassLoader) parent);
-            }
-        }
-    }
     
     public Class<?> loadClass(String name, List<ClassLoader> visitedClassLoaders)
throws ClassNotFoundException {
         return loadClass(name, false, visitedClassLoaders);



Mime
View raw message