CoreTaskService.java 文件源码

java
阅读 39 收藏 0 点赞 0 评论 0

项目:comms-router 作者:
private void cancelTask(EntityManager em, RouterObjectRef taskRef)
    throws NotFoundException, InvalidStateException {

  Task task = app.db.task.get(em, taskRef);

  switch (task.getState()) {
    case waiting:
      assert task.getAgent() == null : "Waiting task " + task.getRef() + " has assigned agent: "
          + task.getAgent().getRef();
      task.makeCanceled();
      return;
    case canceled:
      throw new InvalidStateException("Task already canceled");
    case assigned:
    case completed:
    default:
      throw new InvalidStateException(
          "Current state cannot be switched to canceled: " + task.getState());
  }
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号