geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From hogst...@apache.org
Subject svn commit: r475452 - /geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
Date Wed, 15 Nov 2006 22:02:15 GMT
Author: hogstrom
Date: Wed Nov 15 14:02:15 2006
New Revision: 475452

URL: http://svn.apache.org/viewvc?view=rev&rev=475452
Log:
GERONIMO-2571  Improve classloading performance by directing class loading to known classloader
for certain classes.

Modified:
    geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java

Modified: geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
URL: http://svn.apache.org/viewvc/geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java?view=diff&rev=475452&r1=475451&r2=475452
==============================================================================
--- geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
(original)
+++ geronimo/server/branches/1.1/modules/kernel/src/java/org/apache/geronimo/kernel/config/MultiParentClassLoader.java
Wed Nov 15 14:02:15 2006
@@ -153,7 +153,7 @@
      */
     public MultiParentClassLoader(Artifact id, URL[] urls, ClassLoader[] parents, URLStreamHandlerFactory
factory) {
         super(urls, null, factory);
-        this.id = id;
+        this.id = id;        
         this.parents = copyParents(parents);
         inverseClassLoading = false;
         hiddenClasses = new String[0];
@@ -205,7 +205,23 @@
         if (cachedClass != null) {
             return resolveClass(cachedClass, resolve);
         }
-
+        
+        // This is a reasonable hack.  We can add some classes to the list below.
+        // Since we know these classes are in the system class loader let's not waste our
+        // time going through the hierarchy.
+        //
+        // The order is based on profiling the server.  It may not be optimal for all
+        // workloads.
+        
+        if ( name.startsWith("java.") ||
+          	 name.equals("boolean")   ||
+        	 name.equals("int")       ||
+        	 name.equals("double")    ||
+        	 name.equals("long")) {
+            Class clazz = ClassLoader.getSystemClassLoader().loadClass(name);
+            return resolveClass(clazz, resolve);
+        }
+        
         //
         // if we are using inverse class loading, check local urls first
         //



Mime
View raw message