@SuppressWarnings("unchecked")
private WorkflowAction initialize(WorkflowActionSpecification actionSpec,
ClassLoader classLoader, InstantiatorFactory instantiator) throws Exception {
Class<?> clz = Class.forName(actionSpec.getClassName(), true, classLoader);
Preconditions.checkArgument(WorkflowAction.class.isAssignableFrom(clz), "%s is not a WorkflowAction.", clz);
WorkflowAction action = instantiator.get(TypeToken.of((Class<? extends WorkflowAction>) clz)).create();
try {
action.initialize(new BasicWorkflowContext(workflowSpec, actionSpec,
logicalStartTime, runnerFactory, runtimeArgs));
} catch (Throwable t) {
LOG.warn("Exception on WorkflowAction.initialize(), abort Workflow. {}", actionSpec, t);
// this will always rethrow
Throwables.propagateIfPossible(t, Exception.class);