com.atlassian.plugin.util
Class ContextClassLoaderSwitchingUtil
java.lang.Object
com.atlassian.plugin.util.ContextClassLoaderSwitchingUtil
public class ContextClassLoaderSwitchingUtil
- extends Object
Utility to run Runnable implementations in a different ClassLoader.
- Since:
- 2.5.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ContextClassLoaderSwitchingUtil
public ContextClassLoaderSwitchingUtil()
runInContext
public static void runInContext(ClassLoader newClassLoader,
Runnable runnable)
- Executes the provided
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.
- Parameters:
newClassLoader - The ClassLoader to run the specified Runnable in.runnable - The implementation to be run in the specified ClassLoader
Copyright © 2010 Atlassian. All Rights Reserved.