Path: blob/master/src/java.management/share/classes/javax/management/DefaultLoaderRepository.java
41155 views
/*1* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation. Oracle designates this7* particular file as subject to the "Classpath" exception as provided8* by Oracle in the LICENSE file that accompanied this code.9*10* This code is distributed in the hope that it will be useful, but WITHOUT11* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or12* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License13* version 2 for more details (a copy is included in the LICENSE file that14* accompanied this code).15*16* You should have received a copy of the GNU General Public License version17* 2 along with this work; if not, write to the Free Software Foundation,18* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.19*20* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA21* or visit www.oracle.com if you need additional information or have any22* questions.23*/2425package javax.management;2627import javax.management.loading.ClassLoaderRepository;2829/**30* <p>Keeps the list of Class Loaders registered in the MBean Server.31* It provides the necessary methods to load classes using the registered32* Class Loaders.</p>33*34* <p>This deprecated class is maintained for compatibility. In35* previous versions of the JMX API, there was one36* <code>DefaultLoaderRepository</code> shared by all MBean servers.37* As of version 1.2 of the JMX API, that functionality is38* approximated by using {@link MBeanServerFactory#findMBeanServer} to39* find all known MBean servers, and consulting the {@link40* ClassLoaderRepository} of each one. It is strongly recommended41* that code referencing <code>DefaultLoaderRepository</code> be42* rewritten.</p>43*44* @deprecated Use45* {@link javax.management.MBeanServer#getClassLoaderRepository()}46* instead.47*48* @since 1.549*/50@Deprecated51public class DefaultLoaderRepository {52/**53* Constructs an {@code DefaultLoaderRepository}.54*/55public DefaultLoaderRepository() {}5657/**58* Go through the list of class loaders and try to load the requested class.59* The method will stop as soon as the class is found. If the class60* is not found the method will throw a <CODE>ClassNotFoundException</CODE>61* exception.62*63* @param className The name of the class to be loaded.64*65* @return the loaded class.66*67* @exception ClassNotFoundException The specified class could not be found.68*/69public static Class<?> loadClass(String className)70throws ClassNotFoundException {71return javax.management.loading.DefaultLoaderRepository.loadClass(className);72}737475/**76* Go through the list of class loaders but exclude the given class loader, then try to load77* the requested class.78* The method will stop as soon as the class is found. If the class79* is not found the method will throw a <CODE>ClassNotFoundException</CODE>80* exception.81*82* @param className The name of the class to be loaded.83* @param loader The class loader to be excluded.84*85* @return the loaded class.86*87* @exception ClassNotFoundException The specified class could not be found.88*/89public static Class<?> loadClassWithout(ClassLoader loader,String className)90throws ClassNotFoundException {91return javax.management.loading.DefaultLoaderRepository.loadClassWithout(loader, className);92}9394}959697