javax.management.OperationsException#javax.management.loading.ClassLoaderRepository源码实例Demo

下面列出了javax.management.OperationsException#javax.management.loading.ClassLoaderRepository 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: hottub   文件: ClassLoaderWithRepository.java
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
源代码2 项目: dragonwell8_jdk   文件: JmxMBeanServer.java
/**
 * <b>Package:</b> Creates an MBeanServer.
 * @param domain The default domain name used by this MBeanServer.
 * @param outer A pointer to the MBeanServer object that must be
 *        passed to the MBeans when invoking their
 *        {@link javax.management.MBeanRegistration} interface.
 * @param delegate A pointer to the MBeanServerDelegate associated
 *        with the new MBeanServer. The new MBeanServer must register
 *        this MBean in its MBean repository.
 * @param instantiator The MBeanInstantiator that will be used to
 *        instantiate MBeans and take care of class loading issues.
 * @param metadata The MetaData object that will be used by the
 *        MBean server in order to invoke the MBean interface of
 *        the registered MBeans.
 * @param interceptors If <code>true</code>,
 *        {@link MBeanServerInterceptor} will be enabled (default is
 *        <code>false</code>).
 * @param fairLock If {@code true}, the MBean repository will use a {@link
 *        java.util.concurrent.locks.ReentrantReadWriteLock#ReentrantReadWriteLock(boolean)
 *        fair locking} policy.
 */
JmxMBeanServer(String domain, MBeanServer outer,
               MBeanServerDelegate    delegate,
               MBeanInstantiator      instantiator,
               boolean                interceptors,
               boolean                fairLock)  {

    if (instantiator == null) {
        final ModifiableClassLoaderRepository
            clr = new ClassLoaderRepositorySupport();
        instantiator = new MBeanInstantiator(clr);
    }

    final MBeanInstantiator fInstantiator = instantiator;
    this.secureClr = new
        SecureClassLoaderRepository(AccessController.doPrivileged(new PrivilegedAction<ClassLoaderRepository>() {
            @Override
            public ClassLoaderRepository run() {
                return fInstantiator.getClassLoaderRepository();
            }
        })
    );
    if (delegate == null)
        delegate = new MBeanServerDelegateImpl();
    if (outer == null)
        outer = this;

    this.instantiator = instantiator;
    this.mBeanServerDelegateObject = delegate;
    this.outerShell   = outer;

    final Repository repository = new Repository(domain);
    this.mbsInterceptor =
        new DefaultMBeanServerInterceptor(outer, delegate, instantiator,
                                          repository);
    this.interceptorsEnabled = interceptors;
    initialize();
}
 
源代码3 项目: dragonwell8_jdk   文件: JmxMBeanServer.java
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
 
源代码4 项目: jdk8u-jdk   文件: JmxMBeanServer.java
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
 
源代码5 项目: openjdk-8   文件: ClassLoaderWithRepository.java
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
源代码6 项目: dragonwell8_jdk   文件: RequiredModelMBean.java
private Class<?> loadClass(final String className)
    throws ClassNotFoundException {
    AccessControlContext stack = AccessController.getContext();
    final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];

    Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {

        @Override
        public Class<?> run() {
            try {
                ReflectUtil.checkPackageAccess(className);
                return Class.forName(className);
            } catch (ClassNotFoundException e) {
                final ClassLoaderRepository clr =
                    getClassLoaderRepository();
                try {
                    if (clr == null) throw new ClassNotFoundException(className);
                    return clr.loadClass(className);
                } catch (ClassNotFoundException ex) {
                    caughtException[0] = ex;
                }
            }
            return null;
        }
    }, stack, acc);

    if (caughtException[0] != null) {
        throw caughtException[0];
    }

    return c;
}
 
源代码7 项目: TencentKona-8   文件: JmxMBeanServer.java
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
 
源代码8 项目: TencentKona-8   文件: ClassLoaderWithRepository.java
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
源代码9 项目: jdk8u-jdk   文件: ClassLoaderWithRepository.java
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
源代码10 项目: openjdk-8   文件: JmxMBeanServer.java
/**
 * <b>Package:</b> Creates an MBeanServer.
 * @param domain The default domain name used by this MBeanServer.
 * @param outer A pointer to the MBeanServer object that must be
 *        passed to the MBeans when invoking their
 *        {@link javax.management.MBeanRegistration} interface.
 * @param delegate A pointer to the MBeanServerDelegate associated
 *        with the new MBeanServer. The new MBeanServer must register
 *        this MBean in its MBean repository.
 * @param instantiator The MBeanInstantiator that will be used to
 *        instantiate MBeans and take care of class loading issues.
 * @param metadata The MetaData object that will be used by the
 *        MBean server in order to invoke the MBean interface of
 *        the registered MBeans.
 * @param interceptors If <code>true</code>,
 *        {@link MBeanServerInterceptor} will be enabled (default is
 *        <code>false</code>).
 * @param fairLock If {@code true}, the MBean repository will use a {@link
 *        java.util.concurrent.locks.ReentrantReadWriteLock#ReentrantReadWriteLock(boolean)
 *        fair locking} policy.
 */
JmxMBeanServer(String domain, MBeanServer outer,
               MBeanServerDelegate    delegate,
               MBeanInstantiator      instantiator,
               boolean                interceptors,
               boolean                fairLock)  {

    if (instantiator == null) {
        final ModifiableClassLoaderRepository
            clr = new ClassLoaderRepositorySupport();
        instantiator = new MBeanInstantiator(clr);
    }

    final MBeanInstantiator fInstantiator = instantiator;
    this.secureClr = new
        SecureClassLoaderRepository(AccessController.doPrivileged(new PrivilegedAction<ClassLoaderRepository>() {
            @Override
            public ClassLoaderRepository run() {
                return fInstantiator.getClassLoaderRepository();
            }
        })
    );
    if (delegate == null)
        delegate = new MBeanServerDelegateImpl();
    if (outer == null)
        outer = this;

    this.instantiator = instantiator;
    this.mBeanServerDelegateObject = delegate;
    this.outerShell   = outer;

    final Repository repository = new Repository(domain);
    this.mbsInterceptor =
        new DefaultMBeanServerInterceptor(outer, delegate, instantiator,
                                          repository);
    this.interceptorsEnabled = interceptors;
    initialize();
}
 
源代码11 项目: jdk8u-dev-jdk   文件: JmxMBeanServer.java
/**
 * <b>Package:</b> Creates an MBeanServer.
 * @param domain The default domain name used by this MBeanServer.
 * @param outer A pointer to the MBeanServer object that must be
 *        passed to the MBeans when invoking their
 *        {@link javax.management.MBeanRegistration} interface.
 * @param delegate A pointer to the MBeanServerDelegate associated
 *        with the new MBeanServer. The new MBeanServer must register
 *        this MBean in its MBean repository.
 * @param instantiator The MBeanInstantiator that will be used to
 *        instantiate MBeans and take care of class loading issues.
 * @param metadata The MetaData object that will be used by the
 *        MBean server in order to invoke the MBean interface of
 *        the registered MBeans.
 * @param interceptors If <code>true</code>,
 *        {@link MBeanServerInterceptor} will be enabled (default is
 *        <code>false</code>).
 * @param fairLock If {@code true}, the MBean repository will use a {@link
 *        java.util.concurrent.locks.ReentrantReadWriteLock#ReentrantReadWriteLock(boolean)
 *        fair locking} policy.
 */
JmxMBeanServer(String domain, MBeanServer outer,
               MBeanServerDelegate    delegate,
               MBeanInstantiator      instantiator,
               boolean                interceptors,
               boolean                fairLock)  {

    if (instantiator == null) {
        final ModifiableClassLoaderRepository
            clr = new ClassLoaderRepositorySupport();
        instantiator = new MBeanInstantiator(clr);
    }

    final MBeanInstantiator fInstantiator = instantiator;
    this.secureClr = new
        SecureClassLoaderRepository(AccessController.doPrivileged(new PrivilegedAction<ClassLoaderRepository>() {
            @Override
            public ClassLoaderRepository run() {
                return fInstantiator.getClassLoaderRepository();
            }
        })
    );
    if (delegate == null)
        delegate = new MBeanServerDelegateImpl();
    if (outer == null)
        outer = this;

    this.instantiator = instantiator;
    this.mBeanServerDelegateObject = delegate;
    this.outerShell   = outer;

    final Repository repository = new Repository(domain);
    this.mbsInterceptor =
        new DefaultMBeanServerInterceptor(outer, delegate, instantiator,
                                          repository);
    this.interceptorsEnabled = interceptors;
    initialize();
}
 
源代码12 项目: jdk8u-dev-jdk   文件: JmxMBeanServer.java
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
 
源代码13 项目: jdk8u-jdk   文件: RequiredModelMBean.java
private Class<?> loadClass(final String className)
    throws ClassNotFoundException {
    AccessControlContext stack = AccessController.getContext();
    final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];

    Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {

        @Override
        public Class<?> run() {
            try {
                ReflectUtil.checkPackageAccess(className);
                return Class.forName(className);
            } catch (ClassNotFoundException e) {
                final ClassLoaderRepository clr =
                    getClassLoaderRepository();
                try {
                    if (clr == null) throw new ClassNotFoundException(className);
                    return clr.loadClass(className);
                } catch (ClassNotFoundException ex) {
                    caughtException[0] = ex;
                }
            }
            return null;
        }
    }, stack, acc);

    if (caughtException[0] != null) {
        throw caughtException[0];
    }

    return c;
}
 
源代码14 项目: jdk8u60   文件: JmxMBeanServer.java
/**
 * <b>Package:</b> Creates an MBeanServer.
 * @param domain The default domain name used by this MBeanServer.
 * @param outer A pointer to the MBeanServer object that must be
 *        passed to the MBeans when invoking their
 *        {@link javax.management.MBeanRegistration} interface.
 * @param delegate A pointer to the MBeanServerDelegate associated
 *        with the new MBeanServer. The new MBeanServer must register
 *        this MBean in its MBean repository.
 * @param instantiator The MBeanInstantiator that will be used to
 *        instantiate MBeans and take care of class loading issues.
 * @param metadata The MetaData object that will be used by the
 *        MBean server in order to invoke the MBean interface of
 *        the registered MBeans.
 * @param interceptors If <code>true</code>,
 *        {@link MBeanServerInterceptor} will be enabled (default is
 *        <code>false</code>).
 * @param fairLock If {@code true}, the MBean repository will use a {@link
 *        java.util.concurrent.locks.ReentrantReadWriteLock#ReentrantReadWriteLock(boolean)
 *        fair locking} policy.
 */
JmxMBeanServer(String domain, MBeanServer outer,
               MBeanServerDelegate    delegate,
               MBeanInstantiator      instantiator,
               boolean                interceptors,
               boolean                fairLock)  {

    if (instantiator == null) {
        final ModifiableClassLoaderRepository
            clr = new ClassLoaderRepositorySupport();
        instantiator = new MBeanInstantiator(clr);
    }

    final MBeanInstantiator fInstantiator = instantiator;
    this.secureClr = new
        SecureClassLoaderRepository(AccessController.doPrivileged(new PrivilegedAction<ClassLoaderRepository>() {
            @Override
            public ClassLoaderRepository run() {
                return fInstantiator.getClassLoaderRepository();
            }
        })
    );
    if (delegate == null)
        delegate = new MBeanServerDelegateImpl();
    if (outer == null)
        outer = this;

    this.instantiator = instantiator;
    this.mBeanServerDelegateObject = delegate;
    this.outerShell   = outer;

    final Repository repository = new Repository(domain);
    this.mbsInterceptor =
        new DefaultMBeanServerInterceptor(outer, delegate, instantiator,
                                          repository);
    this.interceptorsEnabled = interceptors;
    initialize();
}
 
源代码15 项目: jdk8u60   文件: JmxMBeanServer.java
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
 
源代码16 项目: jdk8u60   文件: ClassLoaderWithRepository.java
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
源代码17 项目: jdk8u60   文件: RequiredModelMBean.java
private Class<?> loadClass(final String className)
    throws ClassNotFoundException {
    AccessControlContext stack = AccessController.getContext();
    final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];

    Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {

        @Override
        public Class<?> run() {
            try {
                ReflectUtil.checkPackageAccess(className);
                return Class.forName(className);
            } catch (ClassNotFoundException e) {
                final ClassLoaderRepository clr =
                    getClassLoaderRepository();
                try {
                    if (clr == null) throw new ClassNotFoundException(className);
                    return clr.loadClass(className);
                } catch (ClassNotFoundException ex) {
                    caughtException[0] = ex;
                }
            }
            return null;
        }
    }, stack, acc);

    if (caughtException[0] != null) {
        throw caughtException[0];
    }

    return c;
}
 
源代码18 项目: openjdk-jdk8u-backup   文件: JmxMBeanServer.java
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
 
源代码19 项目: jdk8u_jdk   文件: JmxMBeanServer.java
/**
 * <b>Package:</b> Creates an MBeanServer.
 * @param domain The default domain name used by this MBeanServer.
 * @param outer A pointer to the MBeanServer object that must be
 *        passed to the MBeans when invoking their
 *        {@link javax.management.MBeanRegistration} interface.
 * @param delegate A pointer to the MBeanServerDelegate associated
 *        with the new MBeanServer. The new MBeanServer must register
 *        this MBean in its MBean repository.
 * @param instantiator The MBeanInstantiator that will be used to
 *        instantiate MBeans and take care of class loading issues.
 * @param metadata The MetaData object that will be used by the
 *        MBean server in order to invoke the MBean interface of
 *        the registered MBeans.
 * @param interceptors If <code>true</code>,
 *        {@link MBeanServerInterceptor} will be enabled (default is
 *        <code>false</code>).
 * @param fairLock If {@code true}, the MBean repository will use a {@link
 *        java.util.concurrent.locks.ReentrantReadWriteLock#ReentrantReadWriteLock(boolean)
 *        fair locking} policy.
 */
JmxMBeanServer(String domain, MBeanServer outer,
               MBeanServerDelegate    delegate,
               MBeanInstantiator      instantiator,
               boolean                interceptors,
               boolean                fairLock)  {

    if (instantiator == null) {
        final ModifiableClassLoaderRepository
            clr = new ClassLoaderRepositorySupport();
        instantiator = new MBeanInstantiator(clr);
    }

    final MBeanInstantiator fInstantiator = instantiator;
    this.secureClr = new
        SecureClassLoaderRepository(AccessController.doPrivileged(new PrivilegedAction<ClassLoaderRepository>() {
            @Override
            public ClassLoaderRepository run() {
                return fInstantiator.getClassLoaderRepository();
            }
        })
    );
    if (delegate == null)
        delegate = new MBeanServerDelegateImpl();
    if (outer == null)
        outer = this;

    this.instantiator = instantiator;
    this.mBeanServerDelegateObject = delegate;
    this.outerShell   = outer;

    final Repository repository = new Repository(domain);
    this.mbsInterceptor =
        new DefaultMBeanServerInterceptor(outer, delegate, instantiator,
                                          repository);
    this.interceptorsEnabled = interceptors;
    initialize();
}
 
源代码20 项目: jdk8u-dev-jdk   文件: ClassLoaderWithRepository.java
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
源代码22 项目: openjdk-jdk8u   文件: JmxMBeanServer.java
/**
 * <b>Package:</b> Creates an MBeanServer.
 * @param domain The default domain name used by this MBeanServer.
 * @param outer A pointer to the MBeanServer object that must be
 *        passed to the MBeans when invoking their
 *        {@link javax.management.MBeanRegistration} interface.
 * @param delegate A pointer to the MBeanServerDelegate associated
 *        with the new MBeanServer. The new MBeanServer must register
 *        this MBean in its MBean repository.
 * @param instantiator The MBeanInstantiator that will be used to
 *        instantiate MBeans and take care of class loading issues.
 * @param metadata The MetaData object that will be used by the
 *        MBean server in order to invoke the MBean interface of
 *        the registered MBeans.
 * @param interceptors If <code>true</code>,
 *        {@link MBeanServerInterceptor} will be enabled (default is
 *        <code>false</code>).
 * @param fairLock If {@code true}, the MBean repository will use a {@link
 *        java.util.concurrent.locks.ReentrantReadWriteLock#ReentrantReadWriteLock(boolean)
 *        fair locking} policy.
 */
JmxMBeanServer(String domain, MBeanServer outer,
               MBeanServerDelegate    delegate,
               MBeanInstantiator      instantiator,
               boolean                interceptors,
               boolean                fairLock)  {

    if (instantiator == null) {
        final ModifiableClassLoaderRepository
            clr = new ClassLoaderRepositorySupport();
        instantiator = new MBeanInstantiator(clr);
    }

    final MBeanInstantiator fInstantiator = instantiator;
    this.secureClr = new
        SecureClassLoaderRepository(AccessController.doPrivileged(new PrivilegedAction<ClassLoaderRepository>() {
            @Override
            public ClassLoaderRepository run() {
                return fInstantiator.getClassLoaderRepository();
            }
        })
    );
    if (delegate == null)
        delegate = new MBeanServerDelegateImpl();
    if (outer == null)
        outer = this;

    this.instantiator = instantiator;
    this.mBeanServerDelegateObject = delegate;
    this.outerShell   = outer;

    final Repository repository = new Repository(domain);
    this.mbsInterceptor =
        new DefaultMBeanServerInterceptor(outer, delegate, instantiator,
                                          repository);
    this.interceptorsEnabled = interceptors;
    initialize();
}
 
源代码23 项目: openjdk-jdk8u   文件: JmxMBeanServer.java
/**
 * De-serializes a byte array in the context of a given MBean class loader.
 * The class loader is the one that loaded the class with name "className".
 *
 * @param className The name of the class whose class loader should be
 *      used for the de-serialization.
 * @param data The byte array to be de-sererialized.
 *
 * @return  The de-serialized object stream.
 *
 * @exception OperationsException Any of the usual Input/Output
 *      related exceptions.
 * @exception ReflectionException The specified class could not be
 *      loaded by the default loader repository
 *
 */
@Deprecated
public ObjectInputStream deserialize(String className, byte[] data)
    throws OperationsException, ReflectionException {

    if (className == null) {
        throw new  RuntimeOperationsException(
                                    new IllegalArgumentException(),
                                    "Null className passed in parameter");
    }

    /* Permission check */
    // This call requires MBeanPermission 'getClassLoaderRepository'
    final ClassLoaderRepository clr = getClassLoaderRepository();

    Class<?> theClass;
    try {
        if (clr == null) throw new ClassNotFoundException(className);
        theClass = clr.loadClass(className);
    } catch (ClassNotFoundException e) {
        throw new ReflectionException(e,
                                      "The given class could not be " +
                                      "loaded by the default loader " +
                                      "repository");
    }

    return instantiator.deserialize(theClass.getClassLoader(), data);
}
 
源代码24 项目: openjdk-jdk8u   文件: ClassLoaderWithRepository.java
public ClassLoaderWithRepository(ClassLoaderRepository clr,
                                  ClassLoader cl2) {

     if (clr == null) throw new
         IllegalArgumentException("Null ClassLoaderRepository object.");

     repository = clr;
     this.cl2 = cl2;
}
 
源代码25 项目: openjdk-jdk8u   文件: RequiredModelMBean.java
private Class<?> loadClass(final String className)
    throws ClassNotFoundException {
    AccessControlContext stack = AccessController.getContext();
    final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];

    Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {

        @Override
        public Class<?> run() {
            try {
                ReflectUtil.checkPackageAccess(className);
                return Class.forName(className);
            } catch (ClassNotFoundException e) {
                final ClassLoaderRepository clr =
                    getClassLoaderRepository();
                try {
                    if (clr == null) throw new ClassNotFoundException(className);
                    return clr.loadClass(className);
                } catch (ClassNotFoundException ex) {
                    caughtException[0] = ex;
                }
            }
            return null;
        }
    }, stack, acc);

    if (caughtException[0] != null) {
        throw caughtException[0];
    }

    return c;
}
 
源代码26 项目: jdk8u-jdk   文件: RequiredModelMBean.java
private Class<?> loadClass(final String className)
    throws ClassNotFoundException {
    AccessControlContext stack = AccessController.getContext();
    final ClassNotFoundException[] caughtException = new ClassNotFoundException[1];

    Class c = javaSecurityAccess.doIntersectionPrivilege(new PrivilegedAction<Class<?>>() {

        @Override
        public Class<?> run() {
            try {
                ReflectUtil.checkPackageAccess(className);
                return Class.forName(className);
            } catch (ClassNotFoundException e) {
                final ClassLoaderRepository clr =
                    getClassLoaderRepository();
                try {
                    if (clr == null) throw new ClassNotFoundException(className);
                    return clr.loadClass(className);
                } catch (ClassNotFoundException ex) {
                    caughtException[0] = ex;
                }
            }
            return null;
        }
    }, stack, acc);

    if (caughtException[0] != null) {
        throw caughtException[0];
    }

    return c;
}
 
源代码27 项目: jdk8u-jdk   文件: JmxMBeanServer.java
/**
 * <p>Return the ClassLoaderRepository for that MBeanServer.
 * @return The ClassLoaderRepository for that MBeanServer.
 **/
public ClassLoaderRepository getClassLoaderRepository() {
    /* Permission check */
    checkMBeanPermission(null, null, null, "getClassLoaderRepository");
    return secureClr;
}
 
源代码28 项目: jdk1.8-source-analysis   文件: JmxMBeanServer.java
/**
 * <p>Return the ClassLoaderRepository for that MBeanServer.
 * @return The ClassLoaderRepository for that MBeanServer.
 **/
public ClassLoaderRepository getClassLoaderRepository() {
    /* Permission check */
    checkMBeanPermission(null, null, null, "getClassLoaderRepository");
    return secureClr;
}
 
源代码29 项目: openjdk-8-source   文件: JmxMBeanServer.java
/**
 * <p>Return the ClassLoaderRepository for that MBeanServer.
 * @return The ClassLoaderRepository for that MBeanServer.
 **/
public ClassLoaderRepository getClassLoaderRepository() {
    /* Permission check */
    checkMBeanPermission(null, null, null, "getClassLoaderRepository");
    return secureClr;
}
 
源代码30 项目: wildfly-core   文件: BaseMBeanServerPlugin.java
public ClassLoaderRepository getClassLoaderRepository() {
    throw ROOT_LOGGER.unsupportedMethod("getClassLoaderRepository");
}