Examples of TkHbCacheTime


Examples of com.alibaba.jstorm.task.TkHbCacheTime

      taskHBs = new HashMap<Integer, TkHbCacheTime>();

      data.getTaskHeartbeatsCache().put(topologyId, taskHBs);
    }

    TkHbCacheTime taskHB = taskHBs.get(taskId);
    if (taskHB == null) {
      LOG.info("No task heartbeat cache " + idStr);

      if (zkTaskHeartbeat == null) {
        LOG.info("No ZK task hearbeat " + idStr);
        return true;
      }

      taskHB = new TkHbCacheTime();
      taskHB.update(zkTaskHeartbeat);

      taskHBs.put(taskId, taskHB);

      return false;
    }

    if (zkReportTime == null) {
      LOG.debug("No ZK task heartbeat " + idStr);
      // Task hasn't finish init
      int nowSecs = TimeUtils.current_time_secs();
      int assignSecs = taskHB.getTaskAssignedTime();

      int waitInitTimeout = JStormUtils.parseInt(data.getConf().get(
          Config.NIMBUS_TASK_LAUNCH_SECS));

      if (nowSecs - assignSecs > waitInitTimeout) {
        LOG.info(idStr + " failed to init ");
        return true;
      } else {
        return false;
      }

    }

    // the left is zkReportTime isn't null
    // task has finished initialization
    int nimbusTime = taskHB.getNimbusTime();
    int reportTime = taskHB.getTaskReportedTime();

    int nowSecs = TimeUtils.current_time_secs();
    if (nimbusTime == 0) {
      // taskHB no entry, first time
      // update taskHB
      taskHB.setNimbusTime(nowSecs);
      taskHB.setTaskReportedTime(zkReportTime);

      LOG.info("Update taskheartbeat to nimbus cache " + idStr);
      return false;
    }

    if (reportTime != zkReportTime.intValue()) {
      // zk has been updated the report time
      taskHB.setNimbusTime(nowSecs);
      taskHB.setTaskReportedTime(zkReportTime);

      LOG.debug(idStr + ",nimbusTime " + nowSecs + ",zkReport:"
          + zkReportTime + ",report:" + reportTime);
      return false;
    }
View Full Code Here

Examples of com.alibaba.jstorm.task.TkHbCacheTime

        .getTaskStartTimeSecs();
    for (Entry<Integer, Integer> entry : taskStartTimes.entrySet()) {
      Integer taskId = entry.getKey();
      Integer taskStartTime = entry.getValue();

      TkHbCacheTime taskHB = taskHBs.get(taskId);
      if (taskHB == null) {
        taskHB = new TkHbCacheTime();
        taskHBs.put(taskId, taskHB);
      }

      taskHB.setTaskAssignedTime(taskStartTime);
    }

    return;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.