Package com.alibaba.jstorm.daemon.worker

Examples of com.alibaba.jstorm.daemon.worker.WorkerHeartbeat


   */

  public void doHeartbeat() throws IOException {

    int currtime = TimeUtils.current_time_secs();
    WorkerHeartbeat hb = new WorkerHeartbeat(currtime, topologyId,
        task_ids, port);

    LOG.debug("Doing heartbeat:" + worker_id + ",port:" + port + ",hb"
        + hb.toString());

    LocalState state = StormConfig.worker_state(conf, worker_id);
    state.put(Common.LS_WORKER_HEARTBEAT, hb);

  }
View Full Code Here


    LocalState ls = StormConfig.worker_state(conf, workerId);

    while (true) {

      WorkerHeartbeat whb = (WorkerHeartbeat) ls
          .get(Common.LS_WORKER_HEARTBEAT);
      if (whb == null
          && ((TimeUtils.current_time_secs() - startTime) < JStormUtils
              .parseInt(conf
                  .get(Config.SUPERVISOR_WORKER_START_TIMEOUT_SECS)))) {
        LOG.info(workerId + " still hasn't started");
        Time.sleep(500);
      } else {
        // whb is valid or timeout
        break;
      }
    }

    WorkerHeartbeat whb = (WorkerHeartbeat) ls
        .get(Common.LS_WORKER_HEARTBEAT);
    if (whb == null) {
      LOG.error("Failed to start Worker " + workerId);
    } else {
      LOG.info("Successfully start worker " + workerId);
View Full Code Here

    for (Map.Entry<String, WorkerHeartbeat> entry : idToHeartbeat
        .entrySet()) {

      String workerid = entry.getKey().toString();

      WorkerHeartbeat whb = entry.getValue();

      State state = null;

      if (whb == null) {

        state = State.notStarted;

      } else if (matchesAssignment(whb, assignedTasks) == false) {

        // workerId isn't approved or
        // isn't assigned task
        state = State.disallowed;

      } else if ((now - whb.getTimeSecs()) > JStormUtils.parseInt(conf
          .get(Config.SUPERVISOR_WORKER_TIMEOUT_SECS))) {//

        state = State.timedOut;
      } else {
        state = State.valid;
View Full Code Here

    }

    for (String workerId : workerIds) {

      WorkerHeartbeat whb = readWorkerHeartbeat(conf, workerId);

      // ATTENTION: whb can be null
      workerHeartbeats.put(workerId, whb);
    }
    return workerHeartbeats;
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.daemon.worker.WorkerHeartbeat

Copyright © 2018 www.massapicom. 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.