public class ContextClassLoaderSwitchingUtil extends Object
| Constructor and Description |
|---|
ContextClassLoaderSwitchingUtil() |
| Modifier and Type | Method and Description |
|---|---|
static <T> T |
runInContext(ClassLoader newClassLoader,
Callable<T> callable)
Executes the provided
Callable implementation in the specified ClassLoader. |
static void |
runInContext(ClassLoader newClassLoader,
Runnable runnable)
Executes the provided
Runnable implementation in the specified ClassLoader. |
public static void runInContext(ClassLoader newClassLoader, Runnable runnable)
Runnable implementation in the specified ClassLoader.
Utilises the ClassLoaderStack.push(java.lang.ClassLoader) method to save the old ClassLoader and
set the one specified as newClassLoader. ClassLoaderStack.pop() is
called in a finally block to ensure the ClassLoader is set back to the original one.newClassLoader - The ClassLoader to run the specified Runnable in.runnable - The implementation to be run in the specified ClassLoaderpublic static <T> T runInContext(ClassLoader newClassLoader, Callable<T> callable) throws Exception
Callable implementation in the specified ClassLoader.
Utilises the ClassLoaderStack.push(java.lang.ClassLoader) method to save the old ClassLoader and
set the one specified as newClassLoader. ClassLoaderStack.pop() is
called in a finally block to ensure the ClassLoader is set back to the original one.newClassLoader - The ClassLoader to run the specified Runnable in.callable - The implementation to be run in the specified ClassLoaderCallableExceptionCopyright © 2014 Atlassian. All rights reserved.