當前位置: 首頁>>代碼示例>>Java>>正文


Java AlreadyAliveException類代碼示例

本文整理匯總了Java中backtype.storm.generated.AlreadyAliveException的典型用法代碼示例。如果您正苦於以下問題:Java AlreadyAliveException類的具體用法?Java AlreadyAliveException怎麽用?Java AlreadyAliveException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


AlreadyAliveException類屬於backtype.storm.generated包,在下文中一共展示了AlreadyAliveException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
public static void main(String[] args) {
    Config config = new Config();

    HdfsBolt hdfsBolt = makeHdfsBolt();
    KafkaSpout kafkaSpout = makeKafkaSpout(TOPIC, TOPOLOGY_NAME);

    LOG.info("Topology name is {}", TOPOLOGY_NAME);

    TopologyBuilder topologyBuilder = new TopologyBuilder();
    topologyBuilder.setSpout(KAFKA_SPOUT_ID, kafkaSpout, 10);
    topologyBuilder.setBolt(CROP_BOLT_ID, new CropBolt(), 10).shuffleGrouping(KAFKA_SPOUT_ID);
    topologyBuilder.setBolt(SPLIT_FIELDS_BOLT_ID, new SplitFieldsBolt(), 10).shuffleGrouping(CROP_BOLT_ID);
    topologyBuilder.setBolt(STORM_HDFS_BOLT_ID, hdfsBolt, 4).fieldsGrouping(SPLIT_FIELDS_BOLT_ID, new Fields("timestamp", "fieldvalues"));

    if (args != null && args.length > 0) {
        config.setDebug(false);
        config.setNumWorkers(3);

        try {
            StormSubmitter.submitTopology(args[0], config, topologyBuilder.createTopology());
        } catch (InvalidTopologyException | AlreadyAliveException | AuthorizationException e) {
            e.printStackTrace();
        }
    }
}
 
開發者ID:lovelock,項目名稱:storm-demo,代碼行數:26,代碼來源:LogStatisticsTopology.java

示例2: SetRemoteTopology

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
public  void SetRemoteTopology() throws AlreadyAliveException,
		InvalidTopologyException, TopologyAssignException {
	 Config conf = getConf();
	StormTopology topology = buildTopology();

	conf.put(Config.STORM_CLUSTER_MODE, "distributed");
	String streamName = (String) conf.get(Config.TOPOLOGY_NAME);
	if (streamName == null) {
		streamName = "SequenceTest";
	}

	if (streamName.contains("zeromq")) {
		conf.put(Config.STORM_MESSAGING_TRANSPORT,
				"com.alibaba.jstorm.message.zeroMq.MQContext");

	} else {
		conf.put(Config.STORM_MESSAGING_TRANSPORT,
				"com.alibaba.jstorm.message.netty.NettyContext");
	}

	StormSubmitter.submitTopology(streamName, conf,topology);
	
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:24,代碼來源:SequenceTopologyTool.java

示例3: submitTopology

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
public static void submitTopology(String name, Map stormConf,
		StormTopology topology, SubmitOptions opts, List<File> jarFiles)
		throws AlreadyAliveException, InvalidTopologyException {
	if (jarFiles == null) {
		jarFiles = new ArrayList<File>();
	}
	Map<String, String> jars = new HashMap<String, String>(jarFiles.size());
	List<String> names = new ArrayList<String>(jarFiles.size());
	
	for (File f : jarFiles) {
		if (!f.exists()) {
			LOG.info(f.getName() + " is not existed: "
					+ f.getAbsolutePath());
			continue;
		}
		jars.put(f.getName(), f.getAbsolutePath());
		names.add(f.getName());
	}
	LOG.info("Files: " + names + " will be loaded");
	stormConf.put(GenericOptionsParser.TOPOLOGY_LIB_PATH, jars);
	stormConf.put(GenericOptionsParser.TOPOLOGY_LIB_NAME, names);
	submitTopology(name, stormConf, topology, opts);
}
 
開發者ID:zhangjunfang,項目名稱:jstorm-0.9.6.3-,代碼行數:24,代碼來源:StormSubmitter.java

示例4: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
/**
 * Main method.
 * @param args the arguments
 */
public static void main(String[] args) {
  //create the main topology.
    options = new PipelineOptions(args);
    MainTopologyCreator topoCreator = new MainTopologyCreator();
    TopologyOutput topo = topoCreator.createMainTopology();
    //get the topology information
    config = topo.getConfig();
    TopologyBuilder builder = topo.getBuilder();
    int defNumWorkers = topo.getNumWorkers();
    options.toConf(config);
    
    
    if (args != null && args.length > 0) {
        config.setNumWorkers(defNumWorkers);
        try {
            StormSubmitter.submitTopology(args[0], config, builder.createTopology());
        } catch (AlreadyAliveException | InvalidTopologyException e) {
            e.printStackTrace();
        }
    } else {
        final LocalCluster cluster = new LocalCluster();
        cluster.submitTopology(TOPOLOGY_NAME, config, builder.createTopology());
    }
}
 
開發者ID:QualiMaster,項目名稱:Infrastructure,代碼行數:29,代碼來源:TestTopology.java

示例5: submitTopology

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
public static void submitTopology(String name, Map stormConf,
		StormTopology topology, SubmitOptions opts, List<File> jarFiles)
		throws AlreadyAliveException, InvalidTopologyException {
	Map<String, String> jars = new HashMap<String, String>(jarFiles.size());
	List<String> names = new ArrayList<String>(jarFiles.size());
	if (jarFiles == null)
		jarFiles = new ArrayList<File>();
	for (File f : jarFiles) {
		if (!f.exists()) {
			LOG.info(f.getName() + " is not existed: "
					+ f.getAbsolutePath());
			continue;
		}
		jars.put(f.getName(), f.getAbsolutePath());
		names.add(f.getName());
	}
	LOG.info("Files: " + names + " will be loaded");
	stormConf.put(GenericOptionsParser.TOPOLOGY_LIB_PATH, jars);
	stormConf.put(GenericOptionsParser.TOPOLOGY_LIB_NAME, names);
	submitTopology(name, stormConf, topology, opts);
}
 
開發者ID:greeenSY,項目名稱:Tstream,代碼行數:22,代碼來源:StormSubmitter.java

示例6: buildAndSubmit

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
private void buildAndSubmit() throws AlreadyAliveException, InvalidTopologyException, AuthorizationException {
		final int numWorkers = Integer.valueOf(topologyConfig.getProperty("num.workers"));
		Config config = new Config();
		config.setDebug(DEBUG);
		config.setNumWorkers(numWorkers);
		config.setMaxSpoutPending(1000000);
		// https://github.com/apache/storm/tree/v0.10.0/external/storm-kafka
		config.setMessageTimeoutSecs(600);	// This value(30 secs by default) must
							// be larger than retryDelayMaxMs
							// (60 secs by default) in
							/// KafkaSpout.

		TopologyBuilder builder = new TopologyBuilder();
		configureKafkaSpout(builder, config);
		configureESBolts(builder, config);

//		LocalCluster cluster = new LocalCluster();
		StormSubmitter.submitTopology("LogAnalyzerV1", config, builder.createTopology());
	}
 
開發者ID:desp0916,項目名稱:LearnStorm,代碼行數:20,代碼來源:LogAnalyzer.java

示例7: buildAndSubmit

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
private void buildAndSubmit() throws AlreadyAliveException, InvalidTopologyException, AuthorizationException {
		final int numWorkers = Integer.valueOf(topologyConfig.getProperty("num.workers"));
		Config config = new Config();
		config.setDebug(DEBUG);
		config.setNumWorkers(numWorkers);
		config.setMaxSpoutPending(1000000);
		// https://github.com/apache/storm/tree/v0.10.0/external/storm-kafka
		config.setMessageTimeoutSecs(600);	// This value(30 secs by default) must
							// be larger than retryDelayMaxMs
							// (60 secs by default) in
							// KafkaSpout.
		TopologyBuilder builder = new TopologyBuilder();
		configureKafkaSpout(builder, config);
		configureESBolts(builder, config);
//		configureHBaseBolts(builder, config);

//		conf.put(Config.NIMBUS_HOST, "hdp01.localdomain");
//		System.setProperty("storm.jar", "/root/workspace//LearnStorm/target/LearnStorm-0.0.1-SNAPSHOT.jar");
//		System.setProperty("hadoop.home.dir", "/tmp");
//		LocalCluster cluster = new LocalCluster();
		StormSubmitter.submitTopology("ApLogAnalyzerV1", config, builder.createTopology());
	}
 
開發者ID:desp0916,項目名稱:LearnStorm,代碼行數:23,代碼來源:ApLogAnalyzer.java

示例8: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
/**
 * Main method
 */
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
  if (args.length < 1) {
    throw new RuntimeException("Specify topology name");
  }

  int parallelism = 1;
  if (args.length > 1) {
    parallelism = Integer.parseInt(args[1]);
  }
  TopologyBuilder builder = new TopologyBuilder();
  builder.setSpout("word", new WordSpout(), parallelism);
  builder.setBolt("consumer", new ConsumerBolt(), parallelism)
      .fieldsGrouping("word", new Fields("word"));
  Config conf = new Config();
  conf.setNumWorkers(parallelism);

  StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
}
 
開發者ID:twitter,項目名稱:heron,代碼行數:22,代碼來源:WordCountTopology.java

示例9: submitTopology

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
@Override
@SuppressWarnings({"rawtypes", "unchecked"})
public void submitTopology(String topoName,
                           Map config,
                           StormTopology stormTopology)
    throws AlreadyAliveException, InvalidTopologyException {
  assertNotAlive();

  this.topologyName = topoName;
  this.conf = config;
  this.topology = stormTopology;

  simulator.submitTopology(topoName,
      ConfigUtils.translateConfig(config),
      stormTopology.getStormTopology());
}
 
開發者ID:twitter,項目名稱:heron,代碼行數:17,代碼來源:LocalCluster.java

示例10: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
	Config conf = new Config();
	conf.setDebug(true);

	if (args != null && args.length > 0) {
		conf.setNumWorkers(3);

		StormSubmitter.submitTopologyWithProgressBar(args[0], conf, buildTopology(null));
	} else {
		conf.setMaxTaskParallelism(3);
		LocalDRPC drpc = new LocalDRPC();
		LocalCluster cluster = new LocalCluster();
		cluster.submitTopology(SmashBrosTwitterTopology.class.getSimpleName(), conf, buildTopology(drpc));

		Utils.sleep(10 * 60 * 1000); // 10 minutes
		cluster.shutdown();
	}
}
 
開發者ID:danielgimenes,項目名稱:SmashBrosTwitterAnalytics,代碼行數:19,代碼來源:SmashBrosTwitterTopology.java

示例11: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
    Config conf = readConfig(new File(args[1]));

    if (conf == null) {
        throw new RuntimeException("cannot find conf file " + args[1]);
    }
    ResaConfig resaConfig = ResaConfig.create();
    resaConfig.putAll(conf);
    StormTopology topology = createTopology(conf);
    if (args[0].equals("[local]")) {
        resaConfig.setDebug(false);
        LocalCluster localCluster = new LocalCluster();
        localCluster.submitTopology("local", resaConfig, topology);
    } else {
        resaConfig.addDrsSupport();
        resaConfig.registerMetricsConsumer(RedisMetricsCollector.class);
        StormSubmitter.submitTopology(args[0], resaConfig, topology);
    }
}
 
開發者ID:ADSC-Resa,項目名稱:resa,代碼行數:20,代碼來源:SimulatedTopology.java

示例12: run

import backtype.storm.generated.AlreadyAliveException; //導入依賴的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();
}
 
開發者ID:manuzhang,項目名稱:storm-benchmark,代碼行數:23,代碼來源:LocalRunner.java

示例13: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
public static void main(String[] args) throws AlreadyAliveException,
			InvalidTopologyException {
		Config conf = new Config();
//		conf.setDebug(true);
		if (args == null || args.length == 0) {
			// local mode
			LocalCluster cluster = new LocalCluster();
			cluster.submitTopology(TOPOLOGY_NAME, conf, buildTopology());
		} else {
			// distributed mode

			conf.put(Config.STORM_CLUSTER_MODE, new String("distributed"));
			conf.setNumWorkers(1);

			StormSubmitter.submitTopology(args[0], conf, buildTopology());
		}
	}
 
開發者ID:mvogiatzis,項目名稱:probabilistic-counting,代碼行數:18,代碼來源:ProbCountTopology.java

示例14: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
/**
 * @param args
 * @throws InvalidTopologyException 
 * @throws AlreadyAliveException 
 */
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
	TopologyBuilder builder=new TopologyBuilder();
	builder.setSpout("log-writer", new AppLogWriterSpout(),20);
	builder.setBolt("log-writer-file", new AppVisitLogWriterBolt(),20)
					.shuffleGrouping("log-writer");
	Config conf=new Config();
	conf.setNumWorkers(3);
	conf.setDebug(false);
	// ��Ⱥģʽ
	if (args != null && args.length > 0) {
		StormSubmitter.submitTopology(args[0], conf,
				builder.createTopology());
	} else {
		// ����ģʽ
		conf.setMaxTaskParallelism(1);
		LocalCluster cluster = new LocalCluster();
		cluster.submitTopology("logWriter", conf,builder.createTopology());
	}
}
 
開發者ID:yifzhang,項目名稱:storm-miclog,代碼行數:25,代碼來源:AppLogWriterMain.java

示例15: main

import backtype.storm.generated.AlreadyAliveException; //導入依賴的package包/類
/**
 * Get data from db and send message and email for someone or group.
 * @param args
 * @throws InvalidTopologyException 
 * @throws AlreadyAliveException 
 */
public static void main(String[] args) throws AlreadyAliveException, InvalidTopologyException {
	TopologyBuilder builder=new TopologyBuilder();
	builder.setSpout("Log-VisitAlarm-Spout", new AppVisitAlarmSpout(),10);
	//�����ʼ�
	builder.setBolt("Log-Alarm-VisitErrorStatusCode-Bolt",new VisitErrorStatusBolt(), 10)
					.shuffleGrouping("Log-VisitAlarm-Spout");
	Config conf=new Config();
	conf.setDebug(false);
	conf.setNumWorkers(4);
	if (args != null && args.length > 0) {
		StormSubmitter.submitTopology(args[0], conf,builder.createTopology());
	} else {
		conf.setMaxTaskParallelism(1);
		LocalCluster cluster = new LocalCluster();
		cluster.submitTopology("AlarmErrorStatusCode", conf,builder.createTopology());
	}
}
 
開發者ID:yifzhang,項目名稱:storm-miclog,代碼行數:24,代碼來源:AppVisitAlarmMain.java


注:本文中的backtype.storm.generated.AlreadyAliveException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。