Пример #1
0
 /** 清理作业上次运行时信息. 只会在主节点进行. */
 public void cleanPreviousExecutionInfo() {
   if (!isExecutionNodeExisted()) {
     return;
   }
   if (leaderElectionService.isLeader()) {
     jobNodeStorage.fillEphemeralJobNode(ExecutionNode.CLEANING, "");
     List<Integer> items = getAllItems();
     for (int each : items) {
       jobNodeStorage.removeJobNodeIfExisted(ExecutionNode.getCompletedNode(each));
     }
     if (jobNodeStorage.isJobNodeExisted(ExecutionNode.NECESSARY)) {
       fixExecutionInfo(items);
     }
     jobNodeStorage.removeJobNodeIfExisted(ExecutionNode.CLEANING);
   }
   while (jobNodeStorage.isJobNodeExisted(ExecutionNode.CLEANING)) {
     BlockUtils.waitingShortTime();
   }
 }