com.evolveum.midpoint.task.api.TaskManager.deleteTask()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(3.1k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中com.evolveum.midpoint.task.api.TaskManager.deleteTask()方法的一些代码示例,展示了TaskManager.deleteTask()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TaskManager.deleteTask()方法的具体详情如下:
包路径:com.evolveum.midpoint.task.api.TaskManager
类名称:TaskManager
方法名:deleteTask

TaskManager.deleteTask介绍

[英]Deletes task with provided OID. Must fail if object with specified OID does not exists. Should be atomic. BEWARE: call this method only if you are pretty sure the task is not running. Otherwise the running thread will complain when it will try to store task result into repo. (I.e. it is a good practice to suspend the task before deleting.)
[中]使用提供的OID删除任务。如果指定OID的对象不存在,则必须失败。应该是原子的。注意:仅当您非常确定任务未运行时才调用此方法。否则,当运行的线程试图将任务结果存储到repo中时,它会抱怨。(也就是说,在删除前暂停任务是一种良好的做法。)

代码示例

代码示例来源:origin: Evolveum/midpoint

private void deleteTaskChecked(String oid, Statistics s, OperationResult result) {
  try {
    taskManager.deleteTask(oid, result);
    s.tasksRemoved++;
  } catch (ObjectNotFoundException e) {
    LoggingUtils.logUnexpectedException(LOGGER, "Couldn't remove task {} as it seems to be no longer existing", e, oid);
  } catch (RuntimeException|SchemaException e) {
    LoggingUtils.logUnexpectedException(LOGGER, "Couldn't remove task {}", e, oid);
    s.wrongTasksRemaining++;
  }
}

代码示例来源:origin: Evolveum/midpoint

/**
 * Not really a test. Just cleans up after live sync.
 */
@Test
public void test399LiveSyncCleanup() throws Exception {
  final String TEST_NAME = "test399LiveSyncCleanup";
  displayTestTitle(TEST_NAME);
  final OperationResult result = new OperationResult(TestSanity.class.getName()
      + "." + TEST_NAME);
  taskManager.deleteTask(TASK_OPENDJ_SYNC_OID, result);
  // TODO: check if the task is really stopped
}

代码示例来源:origin: Evolveum/midpoint

private boolean deleteWorkersAndWorkState(List<Task> workers, Task task, OperationResult opResult, TaskRunResult runResult)
    throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException {
  deleteWorkState(task, opResult);
  for (Task worker : workers) {
    try {
      List<Task> workerSubtasks = worker.listSubtasks(true, opResult);
      if (!workerSubtasks.isEmpty()) {
        LOGGER.warn("Couldn't recreate worker task {} because it has its own subtasks: {}", worker, workerSubtasks);
        opResult.recordFatalError("Couldn't recreate worker task " + worker + " because it has its own subtasks: " + workerSubtasks);
        runResult.setRunResultStatus(TaskRunResultStatus.TEMPORARY_ERROR);
        return true;
      }
      taskManager.deleteTask(worker.getOid(), opResult);
    } catch (ObjectNotFoundException | SchemaException e) {
      LoggingUtils.logUnexpectedException(LOGGER, "Couldn't delete worker task {} (coordinator {})", e, worker, task);
    }
  }
  return false;
}

代码示例来源:origin: Evolveum/midpoint

taskManager.deleteTask(oid, result);
} else if (NodeType.class.isAssignableFrom(objectTypeClass)) {
  taskManager.deleteNode(oid, result);

代码示例来源:origin: Evolveum/midpoint

taskManager.deleteTask(object.getOid(), result);
} catch (CommonException | RuntimeException | Error e) {
  LoggingUtils.logUnexpectedException(LOGGER, "Couldn't delete completed task {}", e, object);

代码示例来源:origin: Evolveum/midpoint

taskManager.deleteTask(TASK_USER_RECOMPUTE_OID, result);

代码示例来源:origin: Evolveum/midpoint

taskManager.deleteTask(TASK_OPENDJ_RECON_OID, result);

相关文章