@Nullable public static <R>R wrapThreadLoader(ClassLoader ldr,Callable<R> c) throws IgniteCheckedException {
  Thread curThread=Thread.currentThread();
  ClassLoader ctxLdr=curThread.getContextClassLoader();
  try {
    curThread.setContextClassLoader(ldr);
    return c.call();
  }
 catch (  IgniteCheckedException|RuntimeException e) {
    throw e;
  }
catch (  Exception e) {
    throw new IgniteCheckedException(e);
  }
 finally {
    curThread.setContextClassLoader(ctxLdr);
  }
}

@ Nullable public static < R > R wrapThreadLoader ( ClassLoader ldr , Callable < R > c ) throws IgniteCheckedException { Thread curThread = Thread . currentThread ( ) ; ClassLoader ctxLdr = curThread . getContextClassLoader ( ) ; try { curThread . setContextClassLoader ( ldr ) ; return c . call ( ) ; } catch ( IgniteCheckedException | RuntimeException e ) { throw e ; } catch ( Exception e ) { throw new IgniteCheckedException ( e ) ; } finally { curThread . setContextClassLoader ( ctxLdr ) ; } }
sets thread context class loader to the given loader , executes the closure , and then resets thread context class loader to its initial value .
