You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Andreas Veithen (JIRA)" <ji...@apache.org> on 2010/12/28 21:31:46 UTC

[jira] Updated: (AXIS2-4349) Child first class loading

     [ https://issues.apache.org/jira/browse/AXIS2-4349?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Andreas Veithen updated AXIS2-4349:
-----------------------------------

    Fix Version/s: 1.5.5

Merged this to the 1.5 branch because it helps improving support of Axis2 on WAS 7.0.

> Child first class loading
> -------------------------
>
>                 Key: AXIS2-4349
>                 URL: https://issues.apache.org/jira/browse/AXIS2-4349
>             Project: Axis2
>          Issue Type: Improvement
>            Reporter: Amila Chinthaka Suriarachchi
>             Fix For: 1.6, 1.5.5
>
>         Attachments: child_first_class_loading.patch, classloaderpatch.txt
>
>
> Currently Axis2 follows the parent first class loading for service and module loading. 
> The reason for this is it uses DeploymentClassLoader loader which is extended from the ClassLoader class.
> The loadClass method of the ClassLoader class looks like this.
> protected synchronized Class<?> loadClass(String name, boolean resolve)
> 	throws ClassNotFoundException
>     {
> 	// First, check if the class has already been loaded
> 	Class c = findLoadedClass(name);
> 	if (c == null) {
> 	    try {
> 		if (parent != null) {
> 		    c = parent.loadClass(name, false);
> 		} else {
> 		    c = findBootstrapClass0(name);
> 		}
> 	    } catch (ClassNotFoundException e) {
> 	        // If still not found, then invoke findClass in order
> 	        // to find the class.
> 	        c = findClass(name);
> 	    }
> 	}
> 	if (resolve) {
> 	    resolveClass(c);
> 	}
> 	return c;
>     }
> it first check for parent class loader classes and then for its classes. So we can add child first class loading simply reversing this order in a override loadClass method as follows.
> protected synchronized Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
>         Class c = findLoadedClass(name);
>         if (c == null) {
>             try {
>                 c = findClass(name);
>             } catch (Exception e) {
>                 c = super.loadClass(name, resolve);
>             }
>         }
>         return c;
>     }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org