Load the given class name through the list of class loaders,
excluding the given one. Each ClassLoader in turn from the
ClassLoaderRepository, except exclude
, is asked to
load the class via its ClassLoader.loadClass(String)
method. If it successfully returns a Class
object,
that is the result of this method. If it throws a ClassNotFoundException
, the search continues with the next
ClassLoader. If it throws another exception, the exception is
propagated from this method. If the end of the list is
reached, a ClassNotFoundException
is thrown.
Be aware that if a ClassLoader in the ClassLoaderRepository
calls this method from its loadClass
method, it exposes itself to a deadlock if another
ClassLoader in the ClassLoaderRepository does the same thing at
the same time. The ClassLoaderRepository.loadClassBefore(java.lang.ClassLoader, java.lang.String)
method is
recommended to avoid the risk of deadlock.
Returns:
the loaded class.
Parameters:
-
className - The name of the class to be loaded.
-
exclude - The class loader to be excluded. May be null,
in which case this method is equivalent to {@link #loadClass
loadClass(className)}.
Throws:
-
ClassNotFoundException - The specified class could not
be found.