tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r644132 - /incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
Date Thu, 03 Apr 2008 01:43:10 GMT
Author: jsdelfino
Date: Wed Apr  2 18:43:09 2008
New Revision: 644132

URL: http://svn.apache.org/viewvc?rev=644132&view=rev
Log:
Fix for TUSCANY-2182. Changed back to a more standard parent-first classloading scheme in
the node launcher classloader as it's not necessary if the web application classloader is
configured with a parent-last scheme.

Modified:
    incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java

Modified: incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java?rev=644132&r1=644131&r2=644132&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
(original)
+++ incubator/tuscany/java/sca/modules/node2-launcher/src/main/java/org/apache/tuscany/sca/node/launcher/NodeLauncherUtil.java
Wed Apr  2 18:43:09 2008
@@ -341,72 +341,22 @@
     }
 
     /**
-     * Simple URL class loader that hides the parent class loader and implements a
-     * parent-last loading scheme.
+     * Simple URL class loader for the runtime JARs
      */
     private static class RuntimeClassLoader extends URLClassLoader {
-        private ClassLoader parent;
-
+        
         /**
          * Constructs a new class loader.
          * @param urls
          * @param parent
          */
         private RuntimeClassLoader(URL[] urls, ClassLoader parent) {
-            super(urls);
-            this.parent = parent;
+            super(urls, parent);
         }
-
+        
         @Override
-        public URL findResource(String name) {
-            URL url = super.findResource(name);
-            if (url == null) {
-                url = parent.getResource(name);
-            }
-            return url;
-        }
-
-        @Override
-        public Enumeration<URL> findResources(String name) throws IOException {
-            Enumeration<URL> resources = super.findResources(name);
-            Enumeration<URL> parentResources = parent.getResources(name);
-            List<URL> allResources = new ArrayList<URL>(); 
-            for (; resources.hasMoreElements(); ) {
-                allResources.add(resources.nextElement());
-            }
-            for (; parentResources.hasMoreElements(); ) {
-                allResources.add(parentResources.nextElement());
-            }
-            return Collections.enumeration(allResources);
-        }
-
-        @Override
-        protected Class<?> findClass(String name) throws ClassNotFoundException {
-            Class<?> cl;
-
-            // First try to load the class using the parent classloader
-            try {
-                cl = parent.loadClass(name);
-                if (cl.getClassLoader() != parent) {
-
-                    // If the class was not loaded directly by the parent classloader
-                    // try to load it using our URL classloader instead
-                    try {
-                        cl = super.findClass(name);
-                    } catch (ClassNotFoundException e) {
-                        // No class alternative was found in our URL classloader,
-                        // use the class found in the parent classloader hierarchy
-                    }
-                }
-            } catch (ClassNotFoundException e) {
-                
-                // The class was not found by the parent class loader, try
-                // to load it using our URL classloader
-                cl = super.findClass(name);
-            }
-
-            return cl;
+        public Class<?> loadClass(String name) throws ClassNotFoundException {
+            return super.loadClass(name);
         }
     }
-    
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message