@Override public ClassLoader getClassLoader() { return Thread.currentThread().getContextClassLoader(); }
@Override public ClassLoader getClassLoader() { return Thread.currentThread().getContextClassLoader(); }
public CompactedObjectInputStream(InputStream in) throws IOException { this(in, Thread.currentThread().getContextClassLoader()); }
static ClassLoader getContextClassLoader() { if (System.getSecurityManager() == null) { return Thread.currentThread().getContextClassLoader(); } else { return AccessController.doPrivileged(new PrivilegedAction<ClassLoader>() { @Override public ClassLoader run() { return Thread.currentThread().getContextClassLoader(); } }); } }
private static Class<?> arrayForName(String className) throws ClassNotFoundException { return Class.forName(className.endsWith("[]") ? "[L" + className.substring(0, className.length() - 2) + ";" : className, true, Thread.currentThread().getContextClassLoader()); }
private static Class<?> arrayForName(String className) throws ClassNotFoundException { return Class.forName(className.endsWith("[]") ? "[L" + className.substring(0, className.length() - 2) + ";" : className, true, Thread.currentThread().getContextClassLoader()); }
public static Object deserialize(JavaBeanDescriptor beanDescriptor) { Object result = deserialize( beanDescriptor, Thread.currentThread().getContextClassLoader()); return result; }
public static Object deserialize(JavaBeanDescriptor beanDescriptor) { Object result = deserialize( beanDescriptor, Thread.currentThread().getContextClassLoader()); return result; }
@Override @SuppressWarnings("unchecked") public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) { return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker)); }
@Override @SuppressWarnings("unchecked") public <T> T getProxy(Invoker<T> invoker, Class<?>[] interfaces) { return (T) Proxy.newProxyInstance(Thread.currentThread().getContextClassLoader(), interfaces, new InvokerInvocationHandler(invoker)); }
@Override public void contextInitialized(ServletContextEvent event) { CachedIntrospectionResults.acceptClassLoader(Thread.currentThread().getContextClassLoader()); }
public static Class<?> forNameWithThreadContextClassLoader(String name) throws ClassNotFoundException { return forName(name, Thread.currentThread().getContextClassLoader()); }
public static Class<?> forNameWithThreadContextClassLoader(String name) throws ClassNotFoundException { return forName(name, Thread.currentThread().getContextClassLoader()); }
@Override public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { ClassLoader ocl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(invoker.getInterface().getClassLoader()); try { return invoker.invoke(invocation); } finally { Thread.currentThread().setContextClassLoader(ocl); } }
@Override public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException { ClassLoader ocl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(invoker.getInterface().getClassLoader()); try { return invoker.invoke(invocation); } finally { Thread.currentThread().setContextClassLoader(ocl); } }
@Override public void contextDestroyed(ServletContextEvent event) { CachedIntrospectionResults.clearClassLoader(Thread.currentThread().getContextClassLoader()); Introspector.flushCaches(); }
public static ClassGenerator newInstance() { return new ClassGenerator(getClassPool(Thread.currentThread().getContextClassLoader())); }
public static ClassGenerator newInstance() { return new ClassGenerator(getClassPool(Thread.currentThread().getContextClassLoader())); }
public static void setCurrentWebApplicationContext(WebApplicationContext applicationContext) { setCurrentWebApplicationContext(Thread.currentThread().getContextClassLoader(), applicationContext); }
public void testGetResource_contextClassLoaderNull() { ClassLoader oldContextLoader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(null); assertNotNull(Resources.getResource("com/google/common/io/testdata/i18n.txt")); try { Resources.getResource("no such resource"); fail("Should get IllegalArgumentException"); } catch (IllegalArgumentException expected) { } } finally { Thread.currentThread().setContextClassLoader(oldContextLoader); } }