use of com.evolveum.midpoint.repo.common.activity.run.distribution.WorkersReconciliationOptions in project midpoint by Evolveum.
the class TaskActivityManager method reconcileWorkersForActivity.
/**
* Note: common exceptions are not propagated - these are reflected only in the operation result
*/
@NotNull
private WorkersReconciliationResultType reconcileWorkersForActivity(@NotNull Task rootTask, @NotNull TaskType coordinatorTaskBean, @NotNull ActivityPath path, OperationResult parentResult) {
OperationResult result = parentResult.subresult(OP_RECONCILE_WORKERS_FOR_ACTIVITY).addArbitraryObjectAsParam("rootTask", rootTask).addParam("coordinatorTask", coordinatorTaskBean).addArbitraryObjectAsParam("path", path).build();
try {
Task coordinatorTask = taskManager.createTaskInstance(coordinatorTaskBean.asPrismObject(), result);
WorkersReconciliationOptions options = new WorkersReconciliationOptions();
// TODO
options.setDontCloseWorkersWhenWorkDone(true);
return new WorkersReconciliation(rootTask, coordinatorTask, path, options, beans).execute(result);
} catch (CommonException e) {
LoggingUtils.logUnexpectedException(LOGGER, "Couldn't reconcile workers for activity path '{}' in {}/{}", e, path, coordinatorTaskBean, rootTask);
result.recordFatalError(e);
return new WorkersReconciliationResultType(prismContext).status(OperationResultStatusType.FATAL_ERROR);
} catch (Throwable t) {
result.recordFatalError(t);
throw t;
} finally {
result.computeStatusIfUnknown();
}
}
use of com.evolveum.midpoint.repo.common.activity.run.distribution.WorkersReconciliationOptions in project midpoint by Evolveum.
the class DistributingActivityRun method createSuspendedChildren.
private List<Task> createSuspendedChildren(OperationResult result) throws ActivityRunException {
try {
WorkersReconciliationOptions options = new WorkersReconciliationOptions();
options.setCreateSuspended(true);
options.setDontCloseWorkersWhenWorkDone(true);
WorkersReconciliation workersReconciliation = new WorkersReconciliation(getRunningTask().getRootTask(), getRunningTask(), getActivityPath(), options, getBeans());
workersReconciliation.execute(result);
return workersReconciliation.getCurrentWorkers(result);
} catch (CommonException e) {
throw new ActivityRunException("Couldn't create/update activity children (workers)", FATAL_ERROR, PERMANENT_ERROR, e);
}
}
Aggregations