本文整理了Java中org.wildfly.security.manager.WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()
方法的一些代码示例,展示了WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()
方法的具体详情如下:
包路径:org.wildfly.security.manager.WildFlySecurityManager
类名称:WildFlySecurityManager
方法名:getCurrentContextClassLoaderPrivileged
[英]Get the current thread's context class loader, doing a faster permission check that skips having to execute a privileged action frame.
[中]获取当前线程的上下文类加载器,执行更快的权限检查,从而跳过必须执行特权操作框架的操作。
代码示例来源:origin: wildfly/wildfly
public synchronized void clear() {
ClassLoader classLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
final Map<ClassLoader, T> store = new IdentityHashMap<ClassLoader, T>(this.store);
store.remove(classLoader);
if (deploymentClassLoaders.containsKey(classLoader)) {
for (ClassLoader cl : deploymentClassLoaders.get(classLoader)) {
store.remove(cl);
}
}
this.store = store;
}
代码示例来源:origin: wildfly/wildfly
public synchronized void set(T object) {
final Map<ClassLoader, T> store = new IdentityHashMap<ClassLoader, T>(this.store);
ClassLoader classLoader = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
store.put(classLoader, object);
if (deploymentClassLoaders.containsKey(classLoader)) {
for (ClassLoader cl : deploymentClassLoaders.get(classLoader)) {
store.put(cl, object);
}
}
this.store = store;
}
代码示例来源:origin: wildfly/wildfly
@Override
public Properties getBatchConfigurationProperties() {
throw BatchLogger.LOGGER.noBatchEnvironmentFound(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public Handle setup() {
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
return new Handle() {
@Override
public void tearDown() {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
};
}
}
代码示例来源:origin: wildfly/wildfly
public T get() {
T instance = store.get(findParentModuleCl(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged()));
if (instance == null) {
throw WeldLogger.ROOT_LOGGER.singletonNotSet(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
}
return instance;
}
代码示例来源:origin: wildfly/wildfly
@Override
public ArtifactFactory getArtifactFactory() {
throw BatchLogger.LOGGER.noBatchEnvironmentFound(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
}
代码示例来源:origin: wildfly/wildfly
private ClassLoader setClassLoaderTo(final ClassLoader targetClassLoader){
ClassLoader current = null;
if(WildFlySecurityManager.isChecking()){
current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(targetClassLoader);
} else {
current = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(targetClassLoader);
}
return current;
}
}
代码示例来源:origin: wildfly/wildfly
private ClassLoader setClassLoaderTo(final ClassLoader targetClassLoader){
ClassLoader current = null;
if(WildFlySecurityManager.isChecking()){
current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(targetClassLoader);
} else {
current = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(targetClassLoader);
}
return current;
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public ResetContextHandle setup() throws IllegalStateException {
final ClassLoaderResetContextHandle resetContextHandle = new ClassLoaderResetContextHandle(WildFlySecurityManager.getCurrentContextClassLoaderPrivileged());
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
return resetContextHandle;
}
代码示例来源:origin: wildfly/wildfly
@Override
public String getJndiViewInstanceValue() {
final ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(objectFactoryClassInstance.getClass().getClassLoader());
return String.valueOf(getReference().getInstance());
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(cl);
}
}
});
代码示例来源:origin: wildfly/wildfly
public static Class<?> loadClass(final String className, final Module module) throws ClassNotFoundException {
final ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(module.getClassLoader());
return Class.forName(className, false, module.getClassLoader());
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
}
}
代码示例来源:origin: wildfly/wildfly
private ObjectFactory factoryFromReference(final Reference reference, final Hashtable<?, ?> environment) throws Exception {
if (reference.getFactoryClassName() == null) {
return lookForURLs(reference, environment);
}
if (reference instanceof ModularReference) {
return factoryFromModularReference(ModularReference.class.cast(reference), environment);
}
return factoryFromReference(reference, WildFlySecurityManager.getCurrentContextClassLoaderPrivileged(), environment);
}
代码示例来源:origin: wildfly/wildfly
@Override
public List<Long> getRunningExecutions(final String jobName) throws NoSuchJobException, JobSecurityException {
checkState(jobName);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
return super.getRunningExecutions(jobName);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public List<JobInstance> getJobInstances(final String jobName, final int start, final int count) throws NoSuchJobException, JobSecurityException {
checkState(jobName);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
return super.getJobInstances(jobName, start, count);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public int getJobInstanceCount(final String jobName) throws NoSuchJobException, JobSecurityException {
checkState(jobName);
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
return super.getJobInstanceCount(jobName);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void stop(final StopContext context) {
final ClassLoader cl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
ValidatorFactory validatorFactory = deploymentUnit.getAttachment(BeanValidationAttachments.VALIDATOR_FACTORY);
if (validatorFactory != null) {
validatorFactory.close();
}
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(cl);
}
}
代码示例来源:origin: wildfly/wildfly
private void deactivate() {
ClassLoader oldTccl = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
endpoint.deactivate(endpointFactory, activationSpec);
} catch (ResourceException re) {
throw EjbLogger.ROOT_LOGGER.failureDuringEndpointDeactivation(this.getComponentName(), re);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTccl);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public List<JobExecution> getJobExecutions(final JobInstance instance) throws NoSuchJobInstanceException, JobSecurityException {
checkState();
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
validateJob(instance == null ? null : instance.getJobName());
return super.getJobExecutions(instance);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
代码示例来源:origin: wildfly/wildfly
private ValidatorFactory initFactory() {
final ClassLoader oldTCCL = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
return Validation.byDefaultProvider().providerResolver(new WildFlyProviderResolver()).configure()
.buildValidatorFactory();
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(oldTCCL);
}
}
代码示例来源:origin: wildfly/wildfly
@Override
public void stop(final long executionId) throws NoSuchJobExecutionException, JobExecutionNotRunningException, JobSecurityException {
checkState(null, "stop");
final ClassLoader current = WildFlySecurityManager.getCurrentContextClassLoaderPrivileged();
try {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(classLoader);
final JobInstance instance = super.getJobInstance(executionId);
validateJob(instance.getJobName());
super.stop(executionId);
} finally {
WildFlySecurityManager.setCurrentContextClassLoaderPrivileged(current);
}
}
内容来源于网络,如有侵权,请联系作者删除!