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

    return null;
  }
public static <T> T privilegedWithClassLoader(
      ClassLoader classLoader,
      ExceptionSupplier<T> supplier
  ) {
    try {
      return AccessController.doPrivileged((PrivilegedExceptionAction<T>) () -> withClassLoaderInternal(classLoader, supplier));
    } catch (PrivilegedActionException e) {
      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 supplier the Supplier to run within the context of a specified ClassLoader.