本文整理汇总了Java中javax.management.loading.ClassLoaderRepository类的典型用法代码示例。如果您正苦于以下问题:Java ClassLoaderRepository类的具体用法?Java ClassLoaderRepository怎么用?Java ClassLoaderRepository使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ClassLoaderRepository类属于javax.management.loading包,在下文中一共展示了ClassLoaderRepository类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getClassLoaderRepository
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
@Override
public ClassLoaderRepository getClassLoaderRepository() {
Throwable error = null;
MBeanServerPlugin delegate = rootMBeanServer;
final boolean readOnly = true;
try {
//Special authorization
authorizeClassloadingOperation(delegate, GET_CLASSLOADER_REPOSITORY);
return delegate.getClassLoaderRepository();
} catch (Exception e) {
error = e;
throw makeRuntimeException(e);
} finally {
if (shouldAuditLog(delegate, readOnly)) {
new MBeanServerAuditLogRecordFormatter(this, error, readOnly).getClassLoaderRepository();
}
}
}
示例2: JmxMBeanServer
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
/**
* <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: deserialize
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
/**
* 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: ClassLoaderWithRepository
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
public ClassLoaderWithRepository(ClassLoaderRepository clr,
ClassLoader cl2) {
if (clr == null) throw new
IllegalArgumentException("Null ClassLoaderRepository object.");
repository = clr;
this.cl2 = cl2;
}
示例5: loadClass
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
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;
}
示例6: loadClass
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
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: getClassLoaderRepository
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
protected ClassLoaderRepository getClassLoaderRepository()
{
if (m_mbeanServer != null)
return m_mbeanServer.getClassLoaderRepository();
else
return null;
}
示例8: loadClass
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
/**
* Load a class using the default loader repository
**/
Class loadClass(String className)
throws ClassNotFoundException {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
final ClassLoaderRepository clr =
MBeanServerFactory.getClassLoaderRepository(bottomMBS);
if (clr == null) throw new ClassNotFoundException(className);
return clr.loadClass(className);
}
}
示例9: loadClass
import javax.management.loading.ClassLoaderRepository; //导入依赖的package包/类
private Class<?> loadClass(String className)
throws ClassNotFoundException {
try {
return Class.forName(className);
} catch (ClassNotFoundException e) {
final ClassLoaderRepository clr =
getClassLoaderRepository();
if (clr == null) throw new ClassNotFoundException(className);
return clr.loadClass(className);
}
}