Package com.alibaba.jstorm.cluster

Examples of com.alibaba.jstorm.cluster.DistributedClusterState


      Map<Object, Object> tmpConf = new HashMap<Object, Object>();
      tmpConf.putAll(conf);
      tmpConf.put(Config.STORM_ZOOKEEPER_SERVERS, zkServers);
      tmpConf.put(Config.STORM_ZOOKEEPER_ROOT, root);
      zkClient = new DistributedClusterState(tmpConf);

      LOG.info("Successfully connect ZK");
      return zkClient;
    }
View Full Code Here


    return obj.toString();
  }

  public static void readData(String path) {

    DistributedClusterState zkClusterState = null;

    try {
      conf.put(Config.STORM_ZOOKEEPER_ROOT, "/");

      zkClusterState = new DistributedClusterState(conf);

      String data = getData(zkClusterState, path);
      if (data == null) {
        LOG.info("No data of " + path);
      }

      StringBuilder sb = new StringBuilder();

      sb.append("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n");
      sb.append("Zk node " + path + "\n");
      sb.append("Readable data:" + data + "\n");
      sb.append("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\n");

      LOG.info(sb.toString());

    } catch (Exception e) {
      if (zkClusterState == null) {
        LOG.error("Failed to connect ZK ", e);
      } else {
        LOG.error("Failed to read data " + path + "\n", e);
      }
    } finally {
      if (zkClusterState != null) {
        zkClusterState.close();
      }
    }
  }
View Full Code Here

    }
  }

  public static void rmBakTopology(String topologyName) {

    DistributedClusterState zkClusterState = null;

    try {

      zkClusterState = new DistributedClusterState(conf);

      String path = ZkConstant.ASSIGNMENTS_BAK_SUBTREE;
      List<String> bakTopologys = zkClusterState
          .get_children(path, false);

      for (String tid : bakTopologys) {
        if (tid.equals(topologyName)) {
          LOG.info("Find backup " + topologyName);

          String topologyPath = assignment_bak_path(topologyName);
          zkClusterState.delete_node(topologyPath);

          LOG.info("Successfully delete topology " + topologyName
              + " backup Assignment");

          return;
        }
      }

      LOG.info("No backup topology " + topologyName + " Assignment");

    } catch (Exception e) {
      if (zkClusterState == null) {
        LOG.error("Failed to connect ZK ", e);
      } else {
        LOG.error("Failed to delete old topology " + topologyName
            + "\n", e);
      }
    } finally {
      if (zkClusterState != null) {
        zkClusterState.close();
      }
    }

  }
View Full Code Here

  }

  @SuppressWarnings("rawtypes")
  public static ClusterState mk_distributed_cluster_state(Map _conf)
      throws Exception {
    return new DistributedClusterState(_conf);
  }
View Full Code Here

TOP

Related Classes of com.alibaba.jstorm.cluster.DistributedClusterState

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.