Examples of LocalState


Examples of backtype.storm.utils.LocalState

   * @pdOid f0a6ab43-8cd3-44e1-8fd3-015a2ec51c6a
   */
  public void waitForWorkerLaunch(Map conf, String workerId, int startTime)
      throws IOException, InterruptedException {

    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 backtype.storm.utils.LocalState

   */
  public WorkerHeartbeat readWorkerHeartbeat(Map conf, String workerId)
      throws Exception {

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

      return (WorkerHeartbeat) ls.get(Common.LS_WORKER_HEARTBEAT);
    } catch (IOException e) {
      LOG.error("Failed to get worker Heartbeat", e);
      return null;
    }

View Full Code Here

Examples of backtype.storm.utils.LocalState

  public static LocalState worker_state(Map conf, String id)
      throws IOException {
    String path = worker_heartbeats_root(conf, id);

    LocalState rtn = new LocalState(path);
    return rtn;

  }
View Full Code Here

Examples of backtype.storm.utils.LocalState

    return ret;
  }

  public static LocalState supervisorState(Map conf) throws IOException {
    LocalState localState = null;
    try {
      String localstateDir = supervisor_local_dir(conf) + FILE_SEPERATEOR
          + "localstate";
      FileUtils.forceMkdir(new File(localstateDir));
      localState = new LocalState(localstateDir);
    } catch (IOException e) {
      LOG.error("Failed to create supervisor LocalState", e);
      throw e;
    }
    return localState;
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.