MBeanServer.getClassLoaderRepository()
instead.@Deprecated public class DefaultLoaderRepository extends Object
ClassLoader
instances
registered with the management servers, allowing it
to be used to load classes. In early versions of the
JMX API, this class represented a shared repository for
the classloaders of all management servers. The management
of classloaders is now decentralised and this class is
deprecated. The old behaviour is emulated by consulting
the MBeanServer.getClassLoaderRepository()
method
of all the servers obtained from
MBeanServerFactory.findMBeanServer(String)
. Use of
this class should be avoided in new code.Constructor and Description |
---|
DefaultLoaderRepository()
Deprecated.
|
Modifier and Type | Method and Description |
---|---|
static Class |
loadClass(String name)
Deprecated.
Attempts to load the given class using class loaders
supplied by the repository of each
MBeanServer . |
static Class |
loadClassWithout(ClassLoader exclude,
String name)
Deprecated.
Attempts to load the given class using class loaders
supplied by the repository of each
MBeanServer . |
public DefaultLoaderRepository()
public static Class loadClass(String name) throws ClassNotFoundException
MBeanServer
.
The ClassLoader.loadClass(String)
method of each class loader is called. If the method
returns successfully, then the returned Class
instance
is returned. If a ClassNotFoundException
is thrown,
then the next loader is tried. Any other exception thrown
by the method is passed back to the caller. This method
throws a ClassNotFoundException
itself if all the
class loaders listed prove fruitless.name
- the name of the class to load.ClassNotFoundException
- if all the class loaders fail
to load the class.public static Class loadClassWithout(ClassLoader exclude, String name) throws ClassNotFoundException
Attempts to load the given class using class loaders
supplied by the repository of each MBeanServer
.
The ClassLoader.loadClass(String)
method of each class loader is called. If the method
returns successfully, then the returned Class
instance
is returned. If a ClassNotFoundException
is thrown,
then the next loader is tried. Any other exception thrown
by the method is passed back to the caller. This method
throws a ClassNotFoundException
itself if all the
class loaders listed prove fruitless.
Note that this method may deadlock if called simultaneously
by two class loaders in the list.
loadClassBefore(ClassLoader, String)
should be used
in preference to this method to avoid this.
exclude
- the class loader to exclude, or null
to obtain the same behaviour as loadClass(String)
.name
- the name of the class to load.ClassNotFoundException
- if all the class loaders fail
to load the class.