backtype.storm.utils.Utils.readStormConfig()方法的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(6.9k)|赞(0)|评价(0)|浏览(169)

本文整理了Java中backtype.storm.utils.Utils.readStormConfig()方法的一些代码示例,展示了Utils.readStormConfig()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.readStormConfig()方法的具体详情如下:
包路径:backtype.storm.utils.Utils
类名称:Utils
方法名:readStormConfig

Utils.readStormConfig介绍

暂无

代码示例

代码示例来源:origin: alibaba/jstorm

public static Map read_storm_config() {
  return Utils.readStormConfig();
}

代码示例来源:origin: alibaba/jstorm

public static void main(String[] args) {
  if (args == null || args.length == 0) {
    throw new InvalidParameterException("Please input key name");
  }
  String key = args[0];
  Map conf = Utils.readStormConfig();
  System.out.print("VALUE: " + String.valueOf(conf.get(key)));
}

代码示例来源:origin: alibaba/jstorm

public static NimbusClient getNimbusClient(Map conf) {
  if (client != null) {
    return client;
  }
  if (conf == null) {
    conf = Utils.readStormConfig();
  }
  client = NimbusClient.getConfiguredClient(conf);
  return client;
}

代码示例来源:origin: alibaba/jstorm

public static int getSleepSeconds() {
  Map<Object, Object> conf;
  try {
    conf = Utils.readStormConfig();
  } catch (Exception e) {
    conf = new HashMap<>();
  }
  return ConfigExtension.getProcessLauncherSleepSeconds(conf);
}

代码示例来源:origin: alibaba/jstorm

@SuppressWarnings("unchecked")
public static Map getLocalConf(int port) {
  Map conf = Utils.readStormConfig();
  conf.putAll(getLocalBaseConf());
  List<String> zkServers = new ArrayList<>(1);
  zkServers.add("localhost");
  conf.put(Config.STORM_ZOOKEEPER_SERVERS, zkServers);
  conf.put(Config.STORM_ZOOKEEPER_PORT, port);
  ConfigExtension.setTopologyDebugRecvTuple(conf, true);
  conf.put(Config.TOPOLOGY_DEBUG, true);
  conf.put(ConfigExtension.TOPOLOGY_BACKPRESSURE_ENABLE, false);
  return conf;
}

代码示例来源:origin: alibaba/jstorm

public static void main(String[] args) {
    Map<Object, Object> conf = Utils.readStormConfig();
    conf.put("java.sandbox.enable", true);
    SandBoxMaker maker = new SandBoxMaker(conf);
    try {
      System.out.println("sandboxPolicy:" + maker.sandboxPolicy("simple", new HashMap<String, String>()));
    } catch (IOException e) {
      e.printStackTrace();
    }
  }
}

代码示例来源:origin: alibaba/mdrill

public static Map readStormConfig(String filename) {
  Map ret = readStormConfig();
  Map storm = findAndReadConfigFile(filename, false);
  ret.putAll(storm);
  return ret;
}

代码示例来源:origin: alibaba/mdrill

/**
 * Nimbus Server 
 * 
 * @param args
 * @throws Exception 
 */
public static void main(String[] args) throws Exception {
  // ȡļ
  @SuppressWarnings("rawtypes")
  Map config = Utils.readStormConfig();
  // launch-server
  launch_server(config);
}

代码示例来源:origin: alibaba/jstorm

/**
 * @param args
 * @throws DRPCExecutionException
 * @throws TException
 */
public static void main(String[] args) throws Exception {
  
  if (args.length < 1) {
    throw new IllegalArgumentException("Invalid parameter");
  }
  Map conf = Utils.readStormConfig();
  // "foo.com/blog/1" "engineering.twitter.com/blog/5"
  DRPCClient client = new DRPCClient(conf, args[0], 4772);
  String result = client.execute(ReachTopology.TOPOLOGY_NAME, "tech.backtype.com/blog/123");
  
  System.out.println("\n!!! Drpc result:" + result);
}

代码示例来源:origin: alibaba/jstorm

@Deprecated
public static Map getFullConf(Map conf) {
  Map realConf = new HashMap();
  boolean isLocal = StormConfig.try_local_mode(conf);
  if (isLocal) {
    realConf.putAll(LocalCluster.getInstance().getLocalClusterMap().getConf());
  } else {
    realConf.putAll(Utils.readStormConfig());
  }
  realConf.putAll(conf);
  return realConf;
}

代码示例来源:origin: alibaba/jstorm

public Validator(Config conf) {
  this.conf.putAll(Utils.readStormConfig());
  this.conf.putAll(conf);
}

代码示例来源:origin: alibaba/jstorm

public Validator(Config conf) {
  this.conf.putAll(Utils.readStormConfig());
  this.conf.putAll(conf);
}

代码示例来源:origin: alibaba/jstorm

@Override
public void run() {
  LOG.debug("checking changes in storm.yaml...");
  Map newConf = Utils.readStormConfig();
  if (Utils.isConfigChanged(nimbusData.getConf(), newConf)) {
    LOG.warn("detected changes in storm.yaml, updating...");
    synchronized (nimbusData.getConf()) {
      nimbusData.getConf().clear();
      nimbusData.getConf().putAll(newConf);
    }
    RefreshableComponents.refresh(newConf);
  } else {
    LOG.debug("no changes detected, stay put.");
  }
}

代码示例来源:origin: alibaba/jstorm

public static void main(String[] args) throws Exception {
  if (args.length < 2) {
    System.out.println("Invalid parameter");
    usage();
    return;
  }
  conf = Utils.readStormConfig();
  if (args[0].equalsIgnoreCase(READ_CMD)) {
    readData(args[1]);
  } else if (args[0].equalsIgnoreCase(RM_CMD)) {
    rmBakTopology(args[1]);
  } else if (args[0].equalsIgnoreCase(LIST_CMD)) {
    list(args[1]);
  } else if (args[0].equalsIgnoreCase(CLEAN_CMD)) {
    cleanTopology(args[1]);
  }
}

代码示例来源:origin: alibaba/jstorm

public static void init() throws Exception {
  conf = Utils.readStormConfig();
  nimbusInfo = NimbusInfo.fromConf(conf);
  blobStore = BlobStoreUtils.getNimbusBlobStore(conf, nimbusInfo);
  clusterState = Cluster.mk_storm_cluster_state(conf);
  isLocalBlobStore = blobStore instanceof LocalFsBlobStore;
}

代码示例来源:origin: alibaba/jstorm

private static void rollbackTopology(String topologyName) {
  Map conf = Utils.readStormConfig();
  NimbusClient client = NimbusClient.getConfiguredClient(conf);
  try {
    // update jar
    client.getClient().rollbackTopology(topologyName);
    CommandLineUtil.success("Successfully submit command rollback_topology " + topologyName);
  } catch (Exception e) {
    e.printStackTrace();
    throw new RuntimeException(e);
  } finally {
    if (client != null) {
      client.close();
    }
  }
}

代码示例来源:origin: alibaba/jstorm

public static void submitRebalance(String topologyName, RebalanceOptions options, Map conf) throws Exception {
  Map stormConf = Utils.readStormConfig();
  if (conf != null) {
    stormConf.putAll(conf);
  }
  NimbusClient client = null;
  try {
    client = NimbusClient.getConfiguredClient(stormConf);
    client.getClient().rebalance(topologyName, options);
  } catch (Exception e) {
    throw e;
  } finally {
    if (client != null) {
      client.close();
    }
  }
}

代码示例来源:origin: alibaba/jstorm

public static void main(String[] args) throws Exception {
  Thread.setDefaultUncaughtExceptionHandler(new DefaultUncaughtExceptionHandler());
  // read configuration files
  @SuppressWarnings("rawtypes")
  Map config = Utils.readStormConfig();
  JStormServerUtils.startTaobaoJvmMonitor();
  NimbusServer instance = new NimbusServer();
  INimbus iNimbus = new DefaultInimbus();
  instance.launchServer(config, iNimbus);
}

代码示例来源:origin: alibaba/jstorm

private static void completeTopology(String topologyName)
    throws Exception {
  Map conf = Utils.readStormConfig();
  NimbusClient client = NimbusClient.getConfiguredClient(conf);
  try {
    client.getClient().completeUpgrade(topologyName);
    CommandLineUtil.success("Successfully submit command complete_upgrade " + topologyName);
  } catch (Exception ex) {
    CommandLineUtil.error("Failed to perform complete_upgrade: " + ex.getMessage());
    ex.printStackTrace();
  } finally {
    if (client != null) {
      client.close();
    }
  }
}

代码示例来源:origin: alibaba/jstorm

public static void killTopology(Map conf, String topologyName) throws Exception {
  NimbusClientWrapper client = new NimbusClientWrapper();
  try {
    Map clusterConf = Utils.readStormConfig();
    clusterConf.putAll(conf);
    client.init(clusterConf);
    KillOptions killOption = new KillOptions();
    killOption.set_wait_secs(1);
    client.getClient().killTopologyWithOpts(topologyName, killOption);
  } finally {
    client.cleanup();
  }
}

相关文章