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

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

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

Task.getRunningLightweightAsynchronousSubtasks介绍

暂无

代码示例

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

@Override
public void waitForTransientChildren(Task task, OperationResult result) {
  for (Task subtask : task.getRunningLightweightAsynchronousSubtasks()) {
    Future future = ((TaskQuartzImpl) subtask).getLightweightHandlerFuture();
    if (future != null) {       // should always be
      LOGGER.debug("Waiting for subtask {} to complete.", subtask);
      try {
        future.get();
      } catch (CancellationException e) {
        // the Future was cancelled; however, the run() method may be still executing
        // we want to be sure it is already done
        while (((TaskQuartzImpl) subtask).isLightweightHandlerExecuting()) {
          LOGGER.debug("Subtask {} was cancelled, waiting for its real completion.", subtask);
          try {
            Thread.sleep(500);
          } catch (InterruptedException e1) {
            LOGGER.warn("Waiting for subtask {} completion interrupted.", subtask);
            break;
          }
        }
      } catch (Throwable t) {
        LoggingUtils.logUnexpectedException(LOGGER, "Exception while waiting for subtask {} to complete.", t, subtask);
        result.recordWarning("Got exception while waiting for subtask " + subtask + " to complete: " + t.getMessage(), t);
      }
      LOGGER.debug("Waiting for subtask {} done.", subtask);
    }
  }
}

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

assertEquals("Subtask has a wrong lightweight handler", handler, subtask.getLightweightTaskHandler());
assertTrue("Subtask is not in LAT list of parent", task.getLightweightAsynchronousSubtasks().contains(subtask));
assertFalse("Subtask is in Running LAT list of parent", task.getRunningLightweightAsynchronousSubtasks().contains(subtask));
assertFalse("Subtask is marked as already started", subtask.lightweightHandlerStartRequested());
assertTrue("Subtask is not in Running LAT list of parent", task.getRunningLightweightAsynchronousSubtasks().contains(subtask));
assertTrue("Subtask is not marked as already started", subtask.lightweightHandlerStartRequested());

相关文章

微信公众号

最新文章

更多