本文整理了Java中org.apache.catalina.Loader.getClassLoader()
方法的一些代码示例,展示了Loader.getClassLoader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Loader.getClassLoader()
方法的具体详情如下:
包路径:org.apache.catalina.Loader
类名称:Loader
方法名:getClassLoader
[英]Return the Java class loader to be used by this Container.
[中]返回此容器要使用的Java类加载器。
代码示例来源:origin: org.springframework.boot/spring-boot
public void deferredLoadOnStartup() throws LifecycleException {
doWithThreadContextClassLoader(getLoader().getClassLoader(),
() -> getLoadOnStartupWrappers(findChildren()).forEach(this::load));
}
代码示例来源:origin: apache/geode
classLoader = loader.getClassLoader();
代码示例来源:origin: magro/memcached-session-manager
@Override
public ClassLoader getContainerClassLoader() {
return getContainer().getLoader().getClassLoader();
}
代码示例来源:origin: magro/memcached-session-manager
@Override
public ClassLoader getContainerClassLoader() {
return getContext().getLoader().getClassLoader();
}
代码示例来源:origin: magro/memcached-session-manager
@Override
public ClassLoader getContainerClassLoader() {
return getContainer().getLoader().getClassLoader();
}
代码示例来源:origin: magro/memcached-session-manager
@Override
public ClassLoader getContainerClassLoader() {
return getContext().getLoader().getClassLoader();
}
代码示例来源:origin: psi-probe/psi-probe
@Override
protected ModelAndView handleRequestInternal(HttpServletRequest request,
HttpServletResponse response) throws Exception {
/*
* Create a list of webapp classloaders. This will help us to associate threads with
* applications.
*/
List<Context> contexts = getContainerWrapper().getTomcatContainer().findContexts();
Map<String, String> classLoaderMap = new TreeMap<>();
for (Context context : contexts) {
if (context.getLoader() != null && context.getLoader().getClassLoader() != null) {
classLoaderMap.put(toUid(context.getLoader().getClassLoader()), context.getName());
}
}
return new ModelAndView(getViewName(), "threads", enumerateThreads(classLoaderMap));
}
代码示例来源:origin: psi-probe/psi-probe
ClassLoader prevCl = null;
if (ctx != null) {
cl = ctx.getLoader().getClassLoader();
prevCl = ClassUtils.overrideThreadContextClassLoader(cl);
} else {
代码示例来源:origin: psi-probe/psi-probe
new URLClassLoader(new URL[0], context.getLoader().getClassLoader())) {
代码示例来源:origin: psi-probe/psi-probe
new URLClassLoader(new URL[0], context.getLoader().getClassLoader())) {
for (String name : names) {
long time = System.currentTimeMillis();
代码示例来源:origin: psi-probe/psi-probe
ClassLoader cl = ctx.getLoader().getClassLoader();
Object contextLogger = ctx.getLogger();
if (contextLogger != null) {
代码示例来源:origin: psi-probe/psi-probe
try {
Loader loader = ctx.getLoader();
ClassLoader classLoader = loader.getClassLoader();
Log4J2WebLoggerContextUtilsAccessor webLoggerContextUtilsAccessor =
new Log4J2WebLoggerContextUtilsAccessor(classLoader);
代码示例来源:origin: org.glassfish.web/web-glue
@SuppressWarnings("unchecked")
private Class<? extends Servlet> loadServletClass(String className)
throws ClassNotFoundException {
return (Class <? extends Servlet>)
ctx.getLoader().getClassLoader().loadClass(className);
}
}
代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina-ha
public static ClassLoader[] getClassLoaders(Container container) {
Loader loader = null;
ClassLoader classLoader = null;
if (container != null) loader = container.getLoader();
if (loader != null) classLoader = loader.getClassLoader();
else classLoader = Thread.currentThread().getContextClassLoader();
if ( classLoader == Thread.currentThread().getContextClassLoader() ) {
return new ClassLoader[] {classLoader};
} else {
return new ClassLoader[] {classLoader,Thread.currentThread().getContextClassLoader()};
}
}
代码示例来源:origin: codefollower/Tomcat-Research
public ClassLoader[] getClassLoaders() {
Loader loader = null;
ClassLoader classLoader = null;
loader = this.getLoader();
if (loader != null) classLoader = loader.getClassLoader();
if ( classLoader == null ) classLoader = Thread.currentThread().getContextClassLoader();
if ( classLoader == Thread.currentThread().getContextClassLoader() ) {
return new ClassLoader[] {classLoader};
} else {
return new ClassLoader[] {classLoader,Thread.currentThread().getContextClassLoader()};
}
}
代码示例来源:origin: org.apache.tomee/tomee-catalina
private ClassLoader loader() {
if (container == null || !Context.class.isInstance(container)) {
return ParentClassLoaderFinder.Helper.get();
}
final Context ctx = Context.class.cast(container);
return ctx.getLoader() != null && ctx.getLoader().getClassLoader() != null ? ctx.getLoader().getClassLoader() : null;
}
代码示例来源:origin: org.jboss.web/jbossweb
public ClassLoader getClassLoader() {
if (restricted) {
throw MESSAGES.restrictedListenerCannotCallMethod();
}
return context.getLoader().getClassLoader();
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
private void setClassLoaderProperty(String name, boolean value) {
ClassLoader cl = getLoader().getClassLoader();
if (!IntrospectionUtils.setProperty(cl, name, Boolean.toString(value))) {
// Failed to set
log.info(sm.getString(
"standardContext.webappClassLoader.missingProperty",
name, Boolean.toString(value)));
}
}
代码示例来源:origin: codefollower/Tomcat-Research
private void setClassLoaderProperty(String name, boolean value) {
ClassLoader cl = getLoader().getClassLoader();
if (!IntrospectionUtils.setProperty(cl, name, Boolean.toString(value))) {
// Failed to set
log.info(sm.getString(
"standardContext.webappClassLoader.missingProperty",
name, Boolean.toString(value)));
}
}
代码示例来源:origin: org.apache.tomcat/tomcat-catalina
@Override
public void lifecycleEvent(LifecycleEvent event) {
if (event.getType().equals(Lifecycle.AFTER_START_EVENT)) {
if (event.getSource() instanceof Context) {
Context context = ((Context) event.getSource());
childClassLoaders.put(context.getLoader().getClassLoader(),
context.getServletContext().getContextPath());
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!