use of co.cask.cdap.app.runtime.WorkflowTokenProvider in project cdap by caskdata.
the class DefaultProgramWorkflowRunner method runAndWait.
private void runAndWait(ProgramRunner programRunner, Program program, ProgramOptions options) throws Exception {
Closeable closeable = createCloseable(programRunner, program);
ProgramController controller;
try {
controller = programRunner.run(program, options);
} catch (Throwable t) {
// If there is any exception when running the program, close the program to release resources.
// Otherwise it will be released when the execution completed.
Closeables.closeQuietly(closeable);
throw t;
}
blockForCompletion(closeable, controller);
if (controller instanceof WorkflowTokenProvider) {
updateWorkflowToken(((WorkflowTokenProvider) controller).getWorkflowToken());
} else {
// This shouldn't happen
throw new IllegalStateException("No WorkflowToken available after program completed: " + program.getId());
}
}
Aggregations