Exemplo n.º 1
0
  /**
   * 根据停止的节点修复死锁
   *
   * @param node
   */
  public void fixedDeadNodeJob(Node node) {
    try {
      // 1. 判断这个节点的channel是否存在
      ChannelWrapper channelWrapper =
          application
              .getChannelManager()
              .getChannel(node.getGroup(), node.getNodeType(), node.getIdentity());
      if (channelWrapper == null
          || channelWrapper.getChannel() == null
          || channelWrapper.isClosed()) {
        //                List<JobPo> jobPos =
        // application.getExecutingJobQueue().getJobs(node.getIdentity());
        //                if (CollectionUtils.isNotEmpty(jobPos)) {
        //                    for (JobPo jobPo : jobPos) {
        //                        fixedDeadJob(jobPo);
        //                    }
        //                }

        List<TaskExecutingBean> executingTasks =
            InjectorHolder.getInstance(DTaskProvider.class)
                .loadTaskExecutingTasksBytaskTrackerIdentity(node.getIdentity());
        if (CollectionUtils.isNotEmpty(executingTasks)) {
          for (TaskExecutingBean taskExectuing : executingTasks) {
            fixedDeadJob(taskExectuing);
          }
        }
      }
    } catch (Exception t) {
      LOGGER.error(t.getMessage(), t);
    }
  }