Package backtype.storm.utils

Examples of backtype.storm.utils.LocalState


        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


     * Step 4, create LocalStat LocalStat is one KV database
     * 4.1 create LocalState instance
     * 4.2 get or put supervisorId
     */
    //��supervisoridд�뱾��
    LocalState localState = StormConfig.supervisorState(conf);

    String supervisorId = (String) localState.get(Common.LS_ID);
    if (supervisorId == null) {
      supervisorId = UUID.randomUUID().toString();
      localState.put(Common.LS_ID, supervisorId);
    }

    /*
     * Step 5, create event manager EventManger create one thread to handle
     * event get one event from queue, then execute it
View Full Code Here

   * @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) < (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

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

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

    return (WorkerHeartbeat) ls.get(Common.LS_WORKER_HEARTBEAT);
  }
View Full Code Here

    return ret;
  }

  public static LocalState supervisorState(Map conf) {
    LocalState localState = null;
    try {
      localState = new LocalState(supervisor_local_dir(conf)
          + "/localstate");
    } catch (IOException e) {
    }
    return localState;
  }
View Full Code Here

  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

    }
           
    @Override
    public void prepare(Map conf, String localDir) {
        try {
            _state = new LocalState(localDir);
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
        Semaphore initter = new Semaphore(0);
        _executor = new StormExecutor(initter);
View Full Code Here

   
    @Override
    public void prepare(Map conf, String localDir) {
        try {
            _conf = conf;
            _state = new LocalState(localDir);       
            String id = (String) _state.get(FRAMEWORK_ID);
           
            _allowedHosts = listIntoSet((List)_conf.get(CONF_MESOS_ALLOWED_HOSTS));
            _disallowedHosts = listIntoSet((List)_conf.get(CONF_MESOS_DISALLOWED_HOSTS));
View Full Code Here

        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

     * Step 3, create LocalStat LocalStat is one KV database 4.1 create
     * LocalState instance 4.2 get supervisorId, if no supervisorId, create
     * one
     */

    LocalState localState = StormConfig.supervisorState(conf);

    String supervisorId = (String) localState.get(Common.LS_ID);
    if (supervisorId == null) {
      supervisorId = UUID.randomUUID().toString();
      localState.put(Common.LS_ID, supervisorId);
    }

    Vector<SmartThread> threads = new Vector<SmartThread>();

    // Step 5 create HeartBeat
View Full Code Here

TOP

Related Classes of backtype.storm.utils.LocalState

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.