Class ContextLClassLoaderSwapper


  • public class ContextLClassLoaderSwapper
    extends Object
    Utility for temporary swapping the Thread.contextClassLoader. ClassLoader will be switched only if tempClassLoader != null. Example usage:
     ContextLClassLoaderSwapper classLoaderSwapper = new ContextLClassLoaderSwapper(tempCl).swap();
     try {
       ...
     } finally {
       classLoaderSwapper.restore();
     }