Examples of WorkerHeartBeat


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

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

    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

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

    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

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

    }

    for (String workerId : workerIds) {

      WorkerHeartbeat whb = readWorkerHeartbeat(conf, workerId);

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

Examples of com.alipay.bluewhale.core.work.refresh.WorkerHeartbeat

  @SuppressWarnings("rawtypes")
  public static void doHeartbeat(Map conf, String worker_id, int port,
      String storm_id, Set<Integer> task_ids) throws IOException {

    int currtime = TimeUtils.current_time_secs();
    WorkerHeartbeat hb = new WorkerHeartbeat(currtime, storm_id, 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

Examples of com.alipay.bluewhale.core.work.refresh.WorkerHeartbeat

    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) < (Integer) 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.info("Worker " + workerId + "failed to start");
    }
  }
View Full Code Here

Examples of com.alipay.bluewhale.core.work.refresh.WorkerHeartbeat

        Map.Entry<String, WorkerHeartbeat> entry = it.next();

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

        WorkerHeartbeat whb = entry.getValue();

        State state = null;

        if (whb == null) {

          state = State.notStarted;

        } else if (approvedIds == null
            || approvedIds.containsKey(workerid) == false
            || matchesAssignment(whb, assignedTasks) == false) {

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

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

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

Examples of com.alipay.bluewhale.core.work.refresh.WorkerHeartbeat

    if (workerIds != null) {
      workerHeartbeats = new HashMap<String, WorkerHeartbeat>();

      for (String workerId : workerIds) {

        WorkerHeartbeat whb = readWorkerHeartbeat(conf, workerId);
        // this place whb can be null
        workerHeartbeats.put(workerId, whb);
      }
    }
    return workerHeartbeats;
View Full Code Here

Examples of com.taobao.zeus.socket.worker.reqresp.WorkerHeartBeat

    context.setClientWorker(this);
    context.setApplicationContext(applicationContext);
    // 定时发送心跳
    ScheduledExecutorService service = Executors.newScheduledThreadPool(2);
    service.scheduleAtFixedRate(new Runnable() {
      private WorkerHeartBeat heartbeat = new WorkerHeartBeat();
      private int failCount = 0;

      @Override
      public void run() {
        try {
          if (context.getServerChannel() == null) {
            return;
          }
          ChannelFuture cf = heartbeat.execute(context);
          cf.addListener(new ChannelFutureListener() {
            public void operationComplete(ChannelFuture future)
                throws Exception {
              if (!future.isSuccess()) {
                failCount++;
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.