code: public static <InputType, OutputType> OutputType invokeForeignLoader(
        final String clazzName,
        final InputType input,
        final ClassLoader loader
    )
    {
      log.debug("Launching [%s] on class loader [%s] with input class [%s]", clazzName, loader, input.getClass());
      final ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
      try {
        Thread.currentThread().setContextClassLoader(loader);
        final Class<?> clazz = loader.loadClass(clazzName);
        final Method method = clazz.getMethod("runTask", input.getClass());
        return (OutputType) method.invoke(null, input);
      }
      catch (IllegalAccessException | InvocationTargetException | ClassNotFoundException | NoSuchMethodException e) {
        throw new RuntimeException(e);
      }
      finally {
        Thread.currentThread().setContextClassLoader(oldLoader);
      }
    }
docs: This method tries to isolate class loading during a Function call
  
  @param clazzName    The Class which has a static method called `runTask`
  @param input        The input for `runTask`, must have `input.getClass()` be the class of the input for runTask
  @param loader       The loader to use as the context class loader during invocation
  @param <InputType>  The input type of the method.
  @param <OutputType> The output type of the method. The result of runTask must be castable to this type.
  
  @return The result of the method invocation