当前位置: 首页>>代码示例>>Java>>正文


Java Utils.sleep方法代码示例

本文整理汇总了Java中org.apache.storm.utils.Utils.sleep方法的典型用法代码示例。如果您正苦于以下问题:Java Utils.sleep方法的具体用法?Java Utils.sleep怎么用?Java Utils.sleep使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.storm.utils.Utils的用法示例。


在下文中一共展示了Utils.sleep方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupOnce

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
@BeforeClass
public static void setupOnce() throws Exception {
    AbstractStormTest.setupOnce();

    ////////
    Properties overlay = new Properties();
    overlay.setProperty("filter.directory", server.tempDir.getAbsolutePath());

    LaunchEnvironment env = makeLaunchEnvironment(overlay);
    manager = new OFEventWFMTopology(env);
    cluster.submitTopology(manager.makeTopologyName(), stormConfig(), manager.createTopology());

    discoFiler = new KafkaFilerTopology(env, manager.getConfig().getKafkaTopoDiscoTopic());
    cluster.submitTopology("utils-1", stormConfig(), discoFiler.createTopology());

    Utils.sleep(5 * 1000);
    ////////
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:19,代码来源:OFEventWfmTest.java

示例2: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    TopologyBuilder builder = new TopologyBuilder();
    builder.setSpout("integer", new RandomIntegerSpout(), 1);
    builder.setBolt("slidingsum", new SlidingWindowSumBolt().withWindow(new Count(30), new Count(10)), 1)
            .shuffleGrouping("integer");
    builder.setBolt("tumblingavg", new TumblingWindowAvgBolt().withTumblingWindow(new Count(3)), 1)
            .shuffleGrouping("slidingsum");
    builder.setBolt("printer", new PrinterBolt(), 1).shuffleGrouping("tumblingavg");
    Config conf = new Config();
    conf.setDebug(true);
    if (args != null && args.length > 0) {
        conf.setNumWorkers(1);
        StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
    } else {
        LocalCluster cluster = new LocalCluster();
        cluster.submitTopology("test", conf, builder.createTopology());
        Utils.sleep(40000);
        cluster.killTopology("test");
        cluster.shutdown();
    }
}
 
开发者ID:bigdataFlySQL,项目名称:SQLonStorm,代码行数:22,代码来源:SlidingWindowTopology.java

示例3: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    TopologyBuilder builder = new TopologyBuilder();

    builder.setSpout("word", new WordSpout(), 1);
    builder.setBolt("exclaim", new ExclamationBolt(), 1).shuffleGrouping("word");   // Tuple流向:word 》 exclaim
    builder.setBolt("print", new PrintBolt(), 1).shuffleGrouping("exclaim");        // exclaim 》 print

    Config conf = new Config();
    conf.setDebug(true);

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

        StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
    } else {

        LocalCluster cluster = new LocalCluster();      // storm依赖,<scope>provided</scope>--> 本地开发是注释掉 -->
        cluster.submitTopology("test3", conf, builder.createTopology());
        Utils.sleep(60 * 1000);
        cluster.killTopology("test3");
        cluster.shutdown();
    }
}
 
开发者ID:xuxueli,项目名称:xxl-incubator,代码行数:24,代码来源:ExclamationTopology.java

示例4: nextTuple

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void nextTuple() {
    // Sleep for 1 second so the data rate
    // is slower.
    Utils.sleep(1000);
    // Randomly emit device info
    int temperature = _rand.nextInt(11) + 68; // There is a war over whether it's warm or cool in the house
    int humidity = _rand.nextInt(11) + 35; // 35-45 being the recommended humitity in a house
    int co2 = _rand.nextInt(600); // Indoor CO2 range
    //Create a JSON document to send to Event Hub
    // BECAUSE, I learned the hard way that if you don't
    // put it in a nice format that things can interop with,
    // then you have problems later when someone wants
    // to read it into a C# app that uses a framework that
    // expects JSON.
    JSONObject message = new JSONObject();
    message.put("temperature", temperature);
    message.put("humidity", humidity);
    message.put("co2level", co2);
    //Emit the device
    _collector.emit(new Values(message.toString()));
}
 
开发者ID:Azure-Samples,项目名称:hdinsight-java-storm-eventhub,代码行数:23,代码来源:DeviceSpout.java

示例5: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args){
    TopologyBuilder topologyBuilder = new TopologyBuilder();
    topologyBuilder.setSpout(SPOUT_ID,new SentenceSpout());
    topologyBuilder.setBolt(BOLT_ID_SENTENCE_SPLIT,new SentenceSplitBolt()).shuffleGrouping(SPOUT_ID);
    topologyBuilder.setBolt(BOLT_ID_WORD_COUNT,new WordCountBlot()).fieldsGrouping(BOLT_ID_SENTENCE_SPLIT,new Fields("word"));
    topologyBuilder.setBolt(BOLT_ID_COUNT_REPORT,new WordsReportBolt()).globalGrouping(BOLT_ID_WORD_COUNT);

    Config config  = new Config();
    LocalCluster localCluster = new LocalCluster();

    localCluster.submitTopology(TOPOLOGY_ID,config,topologyBuilder.createTopology());
    //
    Utils.sleep(10000);
    localCluster.killTopology(TOPOLOGY_ID);
    localCluster.shutdown();
}
 
开发者ID:yangboz,项目名称:SpringBootKafkaStorm,代码行数:17,代码来源:WordCountTopology.java

示例6: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(final String[] args) throws AlreadyAliveException, InvalidTopologyException,
NotAliveException {

	if (!WordCountTopology.parseParameters(args)) {
		return;
	}

	// build Topology the Storm way
	final TopologyBuilder builder = WordCountTopology.buildTopology();

	// execute program on Flink cluster
	final Config conf = new Config();
	// can be changed to remote address
	conf.put(Config.NIMBUS_HOST, "localhost");
	// use default flink jobmanger.rpc.port
	conf.put(Config.NIMBUS_THRIFT_PORT, 6123);

	final FlinkClient cluster = FlinkClient.getConfiguredClient(conf);
	cluster.submitTopology(topologyId, uploadedJarLocation, FlinkTopology.createTopology(builder));

	Utils.sleep(5 * 1000);

	cluster.killTopology(topologyId);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:25,代码来源:WordCountRemoteByClient.java

示例7: testProgram

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
@Override
protected void testProgram() throws Exception {
	final TopologyBuilder builder = new TopologyBuilder();

	builder.setSpout(spoutId, new MetaDataSpout(), 2);
	builder.setBolt(boltId1, new VerifyMetaDataBolt(), 2).localOrShuffleGrouping(spoutId,
			MetaDataSpout.STREAM_ID);
	builder.setBolt(boltId2, new VerifyMetaDataBolt()).shuffleGrouping(boltId1,
			VerifyMetaDataBolt.STREAM_ID);

	final FlinkLocalCluster cluster = FlinkLocalCluster.getLocalCluster();
	cluster.submitTopology(topologyId, null, FlinkTopology.createTopology(builder));

	// run topology for 5 seconds
	Utils.sleep(5 * 1000);

	cluster.shutdown();

	Assert.assertFalse(VerifyMetaDataBolt.errorOccured);
}
 
开发者ID:axbaretto,项目名称:flink,代码行数:21,代码来源:StormMetaDataITCase.java

示例8: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(final String[] args) throws Exception {

		if (!SplitBoltTopology.parseParameters(args)) {
			return;
		}

		// build Topology the Storm way
		final TopologyBuilder builder = SplitBoltTopology.buildTopology();

		final FlinkLocalCluster cluster = FlinkLocalCluster.getLocalCluster();
		cluster.submitTopology(topologyId, null, FlinkTopology.createTopology(builder));

		// run topology for 5 seconds
		Utils.sleep(5 * 1000);

		cluster.shutdown();
	}
 
开发者ID:axbaretto,项目名称:flink,代码行数:18,代码来源:SplitStreamBoltLocal.java

示例9: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) {
    String consumerKey = args[0]; 
    String consumerSecret = args[1]; 
    String accessToken = args[2]; 
    String accessTokenSecret = args[3];
    String[] arguments = args.clone();
    String[] keyWords = Arrays.copyOfRange(arguments, 4, arguments.length);
    
    TopologyBuilder builder = new TopologyBuilder();
    
    builder.setSpout("twitter", new TwitterSampleSpout(consumerKey, consumerSecret,
                            accessToken, accessTokenSecret, keyWords));
    builder.setBolt("print", new PrinterBolt())
            .shuffleGrouping("twitter");
            
            
    Config conf = new Config();
    
    
    LocalCluster cluster = new LocalCluster();
    
    cluster.submitTopology("test", conf, builder.createTopology());
    
    Utils.sleep(10000);
    cluster.shutdown();
}
 
开发者ID:ziyunhx,项目名称:storm-net-adapter,代码行数:27,代码来源:PrintSampleStream.java

示例10: nextTuple

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
@Override
public void nextTuple() {
	Utils.sleep(_delay);
	
	if(cnt < jsons.size())
	{
		byte[] value;
		if (_converter != null) {
		  value = _converter.convert(jsons.get(cnt));
		} else {
			value = jsons.get(cnt).getBytes();
		}
		_collector.emit(new Values(value));
	}
	cnt ++;
	
	if(_repeating && cnt == jsons.size() -1 )
		cnt = 0;
}
 
开发者ID:apache,项目名称:metron,代码行数:20,代码来源:GenericInternalTestSpout.java

示例11: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  TopologyBuilder builder = new TopologyBuilder();

  builder.setSpout("word", new TestWordSpout(), 10);
  builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word");
  builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1");

  Config conf = new Config();
  conf.setDebug(true);

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

    StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
  }
  else {

    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("test", conf, builder.createTopology());
    Utils.sleep(10000);
    cluster.killTopology("test");
    cluster.shutdown();
  }
}
 
开发者ID:ziyunhx,项目名称:storm-net-adapter,代码行数:25,代码来源:ExclamationTopology.java

示例12: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  TopologyBuilder builder = new TopologyBuilder();

  builder.setSpout("word0", new TestWordSpout(), 2);
  builder.setSpout("word1", new TestWordSpout(), 2);
  builder.setSpout("word2", new TestWordSpout(), 2);
  builder.setBolt("exclaim1", new ExclamationBolt(), 2)
      .shuffleGrouping("word0")
      .shuffleGrouping("word1")
      .shuffleGrouping("word2");

  Config conf = new Config();
  conf.setDebug(true);
  conf.setMaxSpoutPending(10);
  conf.put(Config.TOPOLOGY_WORKER_CHILDOPTS, "-XX:+HeapDumpOnOutOfMemoryError");
  if (args != null && args.length > 0) {
    conf.setNumWorkers(3);
    StormSubmitter.submitTopology(args[0], conf, builder.createTopology());
  } else {
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("test", conf, builder.createTopology());
    Utils.sleep(10000);
    cluster.killTopology("test");
    cluster.shutdown();
  }
}
 
开发者ID:twitter,项目名称:heron,代码行数:27,代码来源:MultiSpoutExclamationTopology.java

示例13: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {

        StormTopology topology = buildDevicesTopology();
        Config conf = new Config();
        conf.setMaxSpoutPending(20);
        if (args.length == 0) {
            LocalCluster cluster = new LocalCluster();
            cluster.submitTopology("devices-topology", conf, topology);
            Utils.sleep(60 * 1000);
            cluster.shutdown();
            System.exit(0);
        } else {
            conf.setNumWorkers(3);
            StormSubmitter.submitTopologyWithProgressBar("devices-topology", conf, topology);
        }
    }
 
开发者ID:ziyunhx,项目名称:storm-net-adapter,代码行数:17,代码来源:TridentMinMaxOfDevicesTopology.java

示例14: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
    Config conf = new Config();
    conf.setMaxSpoutPending(20);
    conf.put(Config.TOPOLOGY_TRIDENT_WINDOWING_INMEMORY_CACHE_LIMIT, 100);

    // window-state table should already be created with cf:tuples column
    HBaseWindowsStoreFactory windowStoreFactory = new HBaseWindowsStoreFactory(new HashMap<String, Object>(), "window-state", "cf".getBytes("UTF-8"), "tuples".getBytes("UTF-8"));

    if (args.length == 0) {
        LocalCluster cluster = new LocalCluster();
        String topologyName = "wordCounterWithWindowing";
        cluster.submitTopology(topologyName, conf, buildTopology(windowStoreFactory));
        Utils.sleep(120 * 1000);
        cluster.killTopology(topologyName);
        cluster.shutdown();
        System.exit(0);
    } else {
        conf.setNumWorkers(3);
        StormSubmitter.submitTopologyWithProgressBar(args[0], conf, buildTopology(windowStoreFactory));
    }
}
 
开发者ID:ziyunhx,项目名称:storm-net-adapter,代码行数:22,代码来源:TridentHBaseWindowingStoreTopology.java

示例15: main

import org.apache.storm.utils.Utils; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
  TopologyBuilder builder = new TopologyBuilder();

  builder.setSpout("word", new TestWordSpout(), 10);
  builder.setBolt("exclaim1", new ExclamationLoggingBolt(), 3).shuffleGrouping("word");
  builder.setBolt("exclaim2", new ExclamationLoggingBolt(), 2).shuffleGrouping("exclaim1");

  Config conf = new Config();
  conf.setDebug(true);

  if (args != null && args.length > 0) {
    conf.setNumWorkers(2);
    StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createTopology());
  } else {
    LocalCluster cluster = new LocalCluster();
    cluster.submitTopology("test", conf, builder.createTopology());
    Utils.sleep(10000);
    cluster.killTopology("test");
    cluster.shutdown();
  }
}
 
开发者ID:ziyunhx,项目名称:storm-net-adapter,代码行数:22,代码来源:MultipleLoggerTopology.java


注:本文中的org.apache.storm.utils.Utils.sleep方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。