|
Préférences
Moteurs de recherche
|
||||||||
JavaTM 2 Platform Std. Ed. v1.6.0
javax.management.loading
|
Method Summary | |
---|---|
Class<?> |
loadClass(String className)
Load the given class name through the list of class loaders. |
Class<?> |
loadClassBefore(ClassLoader stop,
String className)
Load the given class name through the list of class loaders, stopping at the given one. |
Class<?> |
loadClassWithout(ClassLoader exclude,
String className)
Load the given class name through the list of class loaders, excluding the given one. |
Method Detail |
---|
Class<?> loadClass(String className) throws ClassNotFoundException
Load the given class name through the list of class loaders.
Each ClassLoader in turn from the ClassLoaderRepository 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.
className
- The name of the class to be loaded.
ClassNotFoundException
- The specified class could not be
found.Class<?> loadClassWithout(ClassLoader exclude, String className) throws ClassNotFoundException
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 loadClassBefore(java.lang.ClassLoader, java.lang.String)
method is
recommended to avoid the risk of deadlock.
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 loadClass(className)
.
ClassNotFoundException
- The specified class could not
be found.Class<?> loadClassBefore(ClassLoader stop, String className) throws ClassNotFoundException
Load the given class name through the list of class loaders,
stopping at the given one. Each ClassLoader in turn from the
ClassLoaderRepository 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 search reaches stop
or the end of
the list, a ClassNotFoundException
is thrown.
Typically this method is called from the loadClass
method of
stop
, to consult loaders that appear before it
in the ClassLoaderRepository
. By stopping the
search as soon as stop
is reached, a potential
deadlock with concurrent class loading is avoided.
className
- The name of the class to be loaded.stop
- The class loader at which to stop. May be null, in
which case this method is equivalent to loadClass(className)
.
ClassNotFoundException
- The specified class could not
be found.