use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class ResumeHelper method resumeTask.
public void resumeTask(String taskOid, OperationResult result) throws SchemaException, ObjectNotFoundException {
TaskQuartzImpl task = taskRetriever.getTaskPlain(taskOid, result);
resumeTask(task, result);
}
use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class SuspendAndDeleteHelper method deleteTask.
public void deleteTask(String oid, OperationResult result) throws ObjectNotFoundException, SchemaException {
TaskQuartzImpl task = taskRetriever.getTaskPlain(oid, result);
if (task.getNode() != null) {
result.recordWarning("Deleting a task that seems to be currently executing on node " + task.getNode());
}
listenerRegistry.notifyTaskDeleted(task, result);
try {
repositoryService.deleteObject(TaskType.class, oid, result);
} finally {
localScheduler.deleteTaskFromQuartz(oid, false, result);
}
// We could consider unpausing the dependents here. However, they might be already deleted,
// so we have to be prepared to get ObjectNotFoundException here. Or perhaps to unpause something
// that will be deleted milliseconds later (in the case of task tree deletion). Therefore it is
// better NOT to unpause anything -- and to avoid relying on waiting on tasks that are going to be deleted.
// TODO Reconsider. What if there are suspended subtasks that are deleted, and their parents should
// be then unpaused? Maybe the forceful close of the task should be introduced.
}
use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class SuspendAndDeleteHelper method deleteTaskTree.
public void deleteTaskTree(String rootOid, OperationResult result) throws SchemaException, ObjectNotFoundException {
TaskQuartzImpl root = taskRetriever.getTaskPlain(rootOid, result);
LOGGER.debug("Deleting task tree {}", root);
List<TaskQuartzImpl> allTasks = new ArrayList<>(root.listSubtasksDeeply(true, result));
allTasks.add(root);
deleteTasks(allTasks, result);
}
use of com.evolveum.midpoint.task.quartzimpl.TaskQuartzImpl in project midpoint by Evolveum.
the class TaskRetriever method updateFromTaskInMemory.
/**
* Updates selected fields (operation statistics, progress) from in-memory running task.
*/
private void updateFromTaskInMemory(Task task0) {
TaskQuartzImpl task = (TaskQuartzImpl) task0;
if (task.getTaskIdentifier() == null) {
// shouldn't really occur
return;
}
RunningTask taskInMemory = localNodeState.getLocallyRunningTaskByIdentifier(task.getTaskIdentifier());
if (taskInMemory == null) {
return;
}
OperationStatsType operationStats = taskInMemory.getAggregatedLiveOperationStats();
if (operationStats != null) {
operationStats.setLiveInformation(true);
}
task.setOperationStatsTransient(operationStats);
task.setProgressTransient(taskInMemory.getLegacyProgress());
// We intentionally do not try to get operation result from the task. OperationResult class is not thread-safe,
// so it cannot be safely accessed from a different thread. It is not a big problem, because the result should be
// periodically updated in the repository, so we get (at worst) an information that is a few seconds out-of-date.
}
Aggregations