code: private static AbstractInvokable loadAndInstantiateInvokable(
  		ClassLoader classLoader,
  		String className,
  		Environment environment) throws Throwable {
  
  		final Class<? extends AbstractInvokable> invokableClass;
  		try {
  			invokableClass = Class.forName(className, true, classLoader)
  				.asSubclass(AbstractInvokable.class);
  		} catch (Throwable t) {
  			throw new Exception("Could not load the task's invokable class.", t);
  		}
  
  		Constructor<? extends AbstractInvokable> statelessCtor;
  
  		try {
  			statelessCtor = invokableClass.getConstructor(Environment.class);
  		} catch (NoSuchMethodException ee) {
  			throw new FlinkException("Task misses proper constructor", ee);
  		}
  
  		// instantiate the class
  		try {
  			//noinspection ConstantConditions  --> cannot happen
  			return statelessCtor.newInstance(environment);
  		} catch (InvocationTargetException e) {
  			// directly forward exceptions from the eager initialization
  			throw e.getTargetException();
  		} catch (Exception e) {
  			throw new FlinkException("Could not instantiate the task's invokable class.", e);
  		}
  	}
docs: Instantiates the given task invokable class, passing the given environment (and possibly
  the initial task state) to the task's constructor.
  
  <p>The method will first try to instantiate the task via a constructor accepting both
  the Environment and the TaskStateSnapshot. If no such constructor exists, and there is
  no initial state, the method will fall back to the stateless convenience constructor that
  accepts only the Environment.
  
  @param classLoader The classloader to load the class through.
  @param className The name of the class to load.
  @param environment The task environment.
  
  @return The instantiated invokable task object.
  
  @throws Throwable Forwards all exceptions that happen during initialization of the task.
  Also throws an exception if the task class misses the necessary constructor.