Search in sources :

Example 1 with ModifiableClassLoaderRepository

use of com.sun.jmx.mbeanserver.ModifiableClassLoaderRepository in project jdk8u_jdk by JetBrains.

the class DefaultMBeanServerInterceptor method addClassLoader.

/**
     * Registers a ClassLoader with the CLR.
     * This method is called by the ResourceContext from within the
     * repository lock.
     * @param loader       The ClassLoader.
     * @param logicalName  The ClassLoader MBean ObjectName.
     */
private void addClassLoader(ClassLoader loader, final ObjectName logicalName) {
    /**
         * Called when the newly registered MBean is a ClassLoader
         * If so, tell the ClassLoaderRepository (CLR) about it.  We do
         * this even if the loader is a PrivateClassLoader.  In that
         * case, the CLR remembers the loader for use when it is
         * explicitly named (e.g. as the loader in createMBean) but
         * does not add it to the list that is consulted by
         * ClassLoaderRepository.loadClass.
         */
    final ModifiableClassLoaderRepository clr = getInstantiatorCLR();
    if (clr == null) {
        final RuntimeException wrapped = new IllegalArgumentException("Dynamic addition of class loaders" + " is not supported");
        throw new RuntimeOperationsException(wrapped, "Exception occurred trying to register" + " the MBean as a class loader");
    }
    clr.addClassLoader(logicalName, loader);
}
Also used : JMRuntimeException(javax.management.JMRuntimeException) ModifiableClassLoaderRepository(com.sun.jmx.mbeanserver.ModifiableClassLoaderRepository) RuntimeOperationsException(javax.management.RuntimeOperationsException)

Aggregations

ModifiableClassLoaderRepository (com.sun.jmx.mbeanserver.ModifiableClassLoaderRepository)1 JMRuntimeException (javax.management.JMRuntimeException)1 RuntimeOperationsException (javax.management.RuntimeOperationsException)1