use of org.opencastproject.util.JobCanceledException in project opencast by opencast.
the class WorkflowOperationWorker method execute.
/**
* Executes the workflow operation logic.
*/
public WorkflowInstance execute() {
WorkflowOperationInstance operation = workflow.getCurrentOperation();
try {
WorkflowOperationResult result = null;
switch(operation.getState()) {
case INSTANTIATED:
case RETRY:
result = start();
break;
case PAUSED:
result = resume();
break;
default:
throw new IllegalStateException("Workflow operation '" + operation + "' is in unexpected state '" + operation.getState() + "'");
}
if (result == null || Action.CONTINUE.equals(result.getAction()) || Action.SKIP.equals(result.getAction())) {
if (handler != null) {
handler.destroy(workflow, null);
}
}
workflow = service.handleOperationResult(workflow, result);
return workflow;
} catch (JobCanceledException e) {
logger.info(e.getMessage());
return workflow;
} catch (WorkflowOperationAbortedException e) {
// Don't log it as error because it was aborted by the user
logger.info("Workflow operation '" + operation + "' aborted by user");
} catch (Exception e) {
Throwable t = e.getCause();
if (t != null) {
logger.error("Workflow operation '" + operation + "' failed", t);
} else {
logger.error("Workflow operation '" + operation + "' failed", e);
}
// the associated job shares operation's id
service.getServiceRegistry().incident().unhandledException(operation.getId(), Severity.FAILURE, e);
}
try {
workflow = service.handleOperationException(workflow, operation);
} catch (Exception e2) {
logger.error("Error handling workflow operation '{}' failure: {}", operation, e2.getMessage(), e2);
}
return workflow;
}
Aggregations