org.ops4j.pax.swissbox.core
Class ContextClassLoaderUtils
java.lang.Object
org.ops4j.pax.swissbox.core.ContextClassLoaderUtils
public class ContextClassLoaderUtils
- extends Object
Utilities for class loading.
- Since:
- 0.1.0, December 29, 2007
- Author:
- Alin Dreghiciu
Method Summary |
static
|
doWithClassLoader(ClassLoader classLoader,
Callable<V> callable)
Executes a piece of code (callable.call) using a specific class loader set as context class loader. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
doWithClassLoader
public static <V> V doWithClassLoader(ClassLoader classLoader,
Callable<V> callable)
throws Exception
- Executes a piece of code (callable.call) using a specific class loader set as context class loader.
If the curent thread context clas loader is already set, it will be restored after execution.
- Parameters:
classLoader
- clas loader to be used as context clas loader during call.callable
- piece of code to be executed using the clas loader
- Returns:
- return from callable
- Throws:
Exception
- re-thrown from callable
Copyright © 2006-2011 OPS4J - Open Participation Software for Java. All Rights Reserved.