本文整理汇总了Java中org.apache.storm.Config.putAll方法的典型用法代码示例。如果您正苦于以下问题:Java Config.putAll方法的具体用法?Java Config.putAll怎么用?Java Config.putAll使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.storm.Config
的用法示例。
在下文中一共展示了Config.putAll方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.apache.storm.Config; //导入方法依赖的package包/类
private static void run(String name)
throws ClassNotFoundException, IllegalAccessException,
InstantiationException, AlreadyAliveException, InvalidTopologyException {
LOG.info("running benchmark " + name);
IBenchmark benchmark = (IBenchmark) Runner.getApplicationFromName(PACKAGE + "." + name);
Config config = new Config();
config.putAll(Utils.readStormConfig());
config.setDebug(true);
StormTopology topology = benchmark.getTopology(config);
LocalCluster localCluster = new LocalCluster();
localCluster.submitTopology(name, config, topology);
final int runtime = BenchmarkUtils.getInt(config, MetricsCollectorConfig.METRICS_TOTAL_TIME,
MetricsCollectorConfig.DEFAULT_TOTAL_TIME);
IMetricsCollector collector = benchmark.getMetricsCollector(config, topology);
collector.run();
try {
Thread.sleep(runtime);
} catch (InterruptedException e) {
LOG.error("benchmark interrupted", e);
}
localCluster.shutdown();
}
示例2: getTopology
import org.apache.storm.Config; //导入方法依赖的package包/类
@Override
public StormTopology getTopology(Config config) {
config.putAll(getKafkaConfig(config));
final int spoutNum = BenchmarkUtils.getInt(config , SPOUT_NUM, DEFAULT_SPOUT_NUM);
final int boltNum = BenchmarkUtils.getInt(config, BOLT_NUM, DEFAULT_BOLT_NUM);
TopologyBuilder builder = new TopologyBuilder();
builder.setSpout(SPOUT_ID, spout, spoutNum);
builder.setBolt(BOLT_ID, bolt, boltNum).localOrShuffleGrouping(SPOUT_ID);
return builder.createTopology();
}
示例3: submitTopology
import org.apache.storm.Config; //导入方法依赖的package包/类
public static Config submitTopology(ILocalCluster stormCluster, String topologyName,
StormTopology stormTopology) throws Exception {
Config stormConf = new Config();
stormConf.putAll(Utils.readDefaultConfig());
stormConf.put("storm.cluster.mode", "local");
stormConf.setDebug(true);
stormConf.setMaxTaskParallelism(3);
stormConf.put(Config.STORM_TOPOLOGY_SUBMISSION_NOTIFIER_PLUGIN,
org.apache.atlas.storm.hook.StormAtlasHook.class.getName());
stormCluster.submitTopology(topologyName, stormConf, stormTopology);
Thread.sleep(10000);
return stormConf;
}
示例4: getConfig
import org.apache.storm.Config; //导入方法依赖的package包/类
public static Optional<Config> getConfig(CommandLine cli, Config config) {
if(EXTRA_OPTIONS.has(cli)) {
Map<String, Object> extraOptions = readJSONMapFromFile(new File(EXTRA_OPTIONS.get(cli)));
config.putAll(extraOptions);
}
for(ParserOptions option : ParserOptions.values()) {
config = option.configHandler.apply(new Arg(config, option.get(cli)));
}
return config.isEmpty()?Optional.empty():Optional.of(config);
}
示例5: prepare
import org.apache.storm.Config; //导入方法依赖的package包/类
public static void prepare() {
Config conf = new Config();
conf.putAll(Utils.readStormConfig());
store = Utils.getClientBlobStore(conf);
}