|
From: Michael R. <mr...@us...> - 2004-07-28 12:10:34
|
Update of /cvsroot/openorb/OpenORB/src/main/org/openorb/orb/rmi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31268/OpenORB/src/main/org/openorb/orb/rmi Modified Files: UtilDelegateImpl.java Log Message: Also avoid the second RMIClassLoader.loadClass() attempt when the property useLocalCodebase only Index: UtilDelegateImpl.java =================================================================== RCS file: /cvsroot/openorb/OpenORB/src/main/org/openorb/orb/rmi/UtilDelegateImpl.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- UtilDelegateImpl.java 20 Jul 2004 07:22:41 -0000 1.9 +++ UtilDelegateImpl.java 28 Jul 2004 12:10:25 -0000 1.10 @@ -1161,18 +1161,17 @@ { // 1. Find the first non-null ClassLoader on the call stack and attempt to // load the class using this ClassLoader. - // NOTE: The JDK uses a native method to loop through the call stack + // TODO: The JDK uses a native method to loop through the call stack // It gets each method, the class the method is defined for, and the // corresponding class loader. If a non-null class loader is found then // this instance is returned, otherwise NULL is returned. - // After analyzing the Sun JDK source code it seems as if the - // implementation here is not correct. Sun uses the class JDKClassLoader - // which makes the ObjectInputStream's private native method - // latestUserDefinedLoader accessible via reflection. - // (IBM JDK: ???) + // It seems as if this implementation is not correct. + // Sun JDK: Uses JDKClassLoader makes the ObjectInputStream's private native + // method latestUserDefinedLoader accessible via reflection. + // IBM JDK: ??? try { - return Thread.currentThread().getContextClassLoader().loadClass( className ); + return Class.forName( className, false, null ); } catch ( ClassNotFoundException ex ) { @@ -1212,29 +1211,32 @@ } } - // 3. If remoteCodebase is null or useCodebaseOnly is true, then call + // 3. If remoteCodebase is null or localCodebaseOnly is false, then call // java.rmi.server.RMIClassLoader.loadClass(null, className) - try - { - return java.rmi.server.RMIClassLoader.loadClass( ( String ) null, className ); - } - catch ( ClassNotFoundException ex ) + if ( !s_local_codebase_only ) { - if ( getLogger().isDebugEnabled() && Trace.isMedium() ) + try { - getLogger().debug( "Attempt (3) to load the class via the RMIClassLoader" - + " failed as well." ); + return java.rmi.server.RMIClassLoader.loadClass( ( String ) null, className ); } - // try other ways below... - } - catch ( java.net.MalformedURLException ex ) - { - if ( getLogger().isDebugEnabled() && Trace.isMedium() ) + catch ( ClassNotFoundException ex ) { - getLogger().debug( "Attempt (3) to load the class via the RMIClassLoader" - + " failed as well." ); + if ( getLogger().isDebugEnabled() && Trace.isMedium() ) + { + getLogger().debug( "Attempt (3) to load the class via the RMIClassLoader" + + " failed as well." ); + } + // try other ways below... + } + catch ( java.net.MalformedURLException ex ) + { + if ( getLogger().isDebugEnabled() && Trace.isMedium() ) + { + getLogger().debug( "Attempt (3) to load the class via the RMIClassLoader" + + " failed as well." ); + } + // try other ways below... } - // try other ways below... } // 4. If a class was not successfully loaded by step 1, 2, or 3, and loader is non-null, |