PhoenixContextExecutor { public static <T> T call(Callable<T> target) throws Exception { ClassLoader saveCcl = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader( PhoenixContextExecutor.class.getClassLoader()); return target.call(); } finally { Thread.currentThread().setContextClassLoader(saveCcl); } }  static CallWrapper inContext(); static T call(Callable<T> target); static T callWithoutPropagation(Callable<T> target);  }
@Test public void testCall() { URLClassLoader customerClassLoader = new URLClassLoader(new URL[]{}); ClassLoader saveCcl = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(customerClassLoader); try { PhoenixContextExecutor.callWithoutPropagation(new Callable<Object>() { @Override public Object call() { assertEquals( PhoenixContextExecutor.class.getClassLoader(), Thread.currentThread().getContextClassLoader()); return null; } }); } finally { Thread.currentThread().setContextClassLoader(saveCcl); } }