container/src/main/java/com/streamsets/datacollector/util/LambdaUtil.java
public static <T, E1 extends Exception> T privilegedWithClassLoader(
      ClassLoader classLoader,
      Class<E1> e1,
      ExceptionSupplier<T> supplier
  ) throws E1 {
    try {
      return AccessController.doPrivileged((PrivilegedExceptionAction<T>) () -> withClassLoaderInternal(classLoader, supplier));
    } catch (PrivilegedActionException e) {
      Throwables.propagateIfPossible(e.getCause(), e1);
      Throwables.propagate(e);
    }

    return null;
  }
public static <T, E1 extends Exception> T privilegedWithClassLoader(
      ClassLoader classLoader,
      Class<E1> e1,
      ExceptionSupplier<T> supplier
  ) throws E1 {
    try {
      return AccessController.doPrivileged((PrivilegedExceptionAction<T>) () -> withClassLoaderInternal(classLoader, supplier));
    } catch (PrivilegedActionException e) {
      Throwables.propagateIfPossible(e.getCause(), e1);
      Throwables.propagate(e);
    }

    return null;
  }
public static < T , E1 extends Exception > T privilegedWithClassLoader ( ClassLoader classLoader , Class < E1 > e1 , ExceptionSupplier < T > supplier ) throws E1 { try { return AccessController . doPrivileged ( ( PrivilegedExceptionAction < T > ) ( ) -> withClassLoaderInternal ( classLoader , supplier ) ) ; } catch ( PrivilegedActionException e ) { Throwables . propagateIfPossible ( e . getCause ( ) , e1 ) ; Throwables . propagate ( e ) ; } return null ; }
Runs a Supplier within the context of a specified ClassLoader and in priviledged mode.

@param classLoader the ClassLoader to run the Supplier.
@param e1 Exception class that should be propagated as-is
@param supplier the Supplier to run within the context of a specified ClassLoader.
Runs a Supplier within the context of a specified ClassLoader and in priviledged mode .