This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.management.loading
interface ClassLoaderRepository


public interface ClassLoaderRepository

Instances of this interface are used to keep the list of ClassLoaders registered in an MBean Server. They provide the necessary methods to load classes using the registered ClassLoaders.

The first ClassLoader in a ClassLoaderRepository is always the MBean Server's own ClassLoader.

When an MBean is registered in an MBean Server, if it is of a subclass of {@link java.lang.ClassLoader} and if it does not implement the interface {@link PrivateClassLoader}, it is added to the end of the MBean Server's ClassLoaderRepository. If it is subsequently unregistered from the MBean Server, it is removed from the ClassLoaderRepository.

The order of MBeans in the ClassLoaderRepository is significant. For any two MBeans X and Y in the ClassLoaderRepository, X must appear before Y if the registration of X was completed before the registration of Y started. If X and Y were registered concurrently, their order is indeterminate. The registration of an MBean corresponds to the call to {@link MBeanServer#registerMBean} or one of the {@link MBeanServer}.createMBean methods.


Method Summary
 Class
loadClass(String className)

          Load the given class name through the list of class loaders.
 Class

          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

loadClass

public 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 {@link ClassLoader#loadClass(String)} method. If it successfully returns a {@link Class} object, that is the result of this method. If it throws a {@link 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 {@link ClassNotFoundException} is thrown.

Parameters:
className - The name of the class to be loaded.
Returns:
the loaded class.
Throws:
ClassNotFoundException - The specified class could not be found.

loadClassBefore

public 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 {@link ClassLoader#loadClass(String)} method. If it successfully returns a {@link Class} object, that is the result of this method. If it throws a {@link 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 {@link ClassNotFoundException} is thrown.

Typically this method is called from the {@link ClassLoader#loadClass(String) 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.

Parameters:
stop - The class loader at which to stop. May be null, in which case this method is equivalent to {@link #loadClass(String) loadClass(className)}.
className - The name of the class to be loaded.
Returns:
the loaded class.
Throws:
ClassNotFoundException - The specified class could not be found.

loadClassWithout

public 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 {@link ClassLoader#loadClass(String)} method. If it successfully returns a {@link Class} object, that is the result of this method. If it throws a {@link 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 {@link ClassNotFoundException} is thrown.

Be aware that if a ClassLoader in the ClassLoaderRepository calls this method from its {@link ClassLoader#loadClass(String) loadClass} method, it exposes itself to a deadlock if another ClassLoader in the ClassLoaderRepository does the same thing at the same time. The {@link #loadClassBefore} method is recommended to avoid the risk of deadlock.

Parameters:
exclude - The class loader to be excluded. May be null, in which case this method is equivalent to {@link #loadClass loadClass(className)}.
className - The name of the class to be loaded.
Returns:
the loaded class.
Throws:
ClassNotFoundException - The specified class could not be found.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.