本文整理汇总了Java中backtype.storm.LocalDRPC.shutdown方法的典型用法代码示例。如果您正苦于以下问题:Java LocalDRPC.shutdown方法的具体用法?Java LocalDRPC.shutdown怎么用?Java LocalDRPC.shutdown使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类backtype.storm.LocalDRPC
的用法示例。
在下文中一共展示了LocalDRPC.shutdown方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
if (args == null || args.length == 0) {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach-drpc", conf, builder.createLocalTopology(drpc));
String[] urlsToTry = new String[]{ "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com" };
for (String url : urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(6);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
示例2: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[]{ "hello", "goodbye" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
示例3: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String args[]) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[] { "hello", "goodbye" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
Thread.sleep(10000);
drpc.shutdown();
cluster.shutdown();
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
示例4: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LocalDRPC drpc = new LocalDRPC();
Config conf = new Config();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach", conf, buildTopology(drpc));
Thread.sleep(2000);
System.out.println("REACH: " + drpc.execute("reach", "aaa"));
System.out.println("REACH: " + drpc.execute("reach", "foo.com/blog/1"));
System.out.println("REACH: " + drpc.execute("reach", "engineering.twitter.com/blog/5"));
cluster.shutdown();
drpc.shutdown();
}
示例5: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[]{ "hello", "goodbye", "apple", "orange", "banana" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
Thread.sleep(10000);
drpc.shutdown();
cluster.shutdown();
}
else {
conf.setNumWorkers(3);
StormSubmitter.submitTopologyWithProgressBar(args[0], conf, builder.createRemoteTopology());
}
}
示例6: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
if (args == null || args.length == 0) {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach-drpc", conf, builder.createLocalTopology(drpc));
String[] urlsToTry = new String[]{ "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com" };
for (String url : urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(6);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
示例7: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if (args == null || args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for (String word : new String[]{ "hello", "goodbye" }) {
System.out.println("Result for \"" + word + "\": " + drpc.execute("exclamation", word));
}
cluster.shutdown();
drpc.shutdown();
}
else {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
示例8: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Config config = new Config();
config.setDebug(false);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("internet-radio-play-stats", config, TopologyBuilder.buildLocal(drpc));
Utils.sleep(ONE_MINUTE);
String result = drpc.execute("count-request-by-tag", "Classic Rock,Punk,Post Punk");
System.out.println("RESULTS");
System.out.println("==========================================================================");
System.out.println(result);
System.out.println("==========================================================================");
cluster.killTopology("internet-radio-play-stats");
cluster.shutdown();
drpc.shutdown();
}
示例9: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
if(args==null || args.length==0) {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach-drpc", conf, builder.createLocalTopology(drpc));
String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com"};
for(String url: urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute("reach", url));
}
cluster.shutdown();
drpc.shutdown();
} else {
conf.setNumWorkers(6);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
示例10: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = new LinearDRPCTopologyBuilder("exclamation");
builder.addBolt(new ExclaimBolt(), 3);
Config conf = new Config();
if(args==null || args.length==0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("drpc-demo", conf, builder.createLocalTopology(drpc));
for(String word: new String[] {"hello", "goodbye"}) {
System.out.println("Result for \"" + word + "\": "
+ drpc.execute("exclamation", word));
}
cluster.shutdown();
drpc.shutdown();
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, builder.createRemoteTopology());
}
}
示例11: testDrpc
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void testDrpc() {
TopologyBuilder builder = new TopologyBuilder();
LocalDRPC drpc = new LocalDRPC();
DRPCSpout spout = new DRPCSpout("exclamation", drpc);
builder.setSpout("drpc", spout);
builder.setBolt("exclaim", new ExclamationBolt(), 3).shuffleGrouping("drpc");
builder.setBolt("return", new ReturnResults(), 3).shuffleGrouping("exclaim");
LocalCluster cluster = new LocalCluster();
Config conf = new Config();
cluster.submitTopology("exclaim", conf, builder.createTopology());
JStormUtils.sleepMs(30 * 1000);
try {
System.out.println(drpc.execute("exclamation", "aaa"));
System.out.println(drpc.execute("exclamation", "bbb"));
} catch (Exception e) {
Assert.fail("Failed to test drpc");
}
drpc.shutdown();
cluster.shutdown();
}
示例12: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String... args) throws Exception {
Config conf = new Config();
conf.setMaxSpoutPending(20);
if (args.length == 0) {
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("wordCounter", conf, buildTopology(drpc));
for (int i = 0; i < 3; i++) {
System.out.println("DRPC RESULT: " + drpc.execute("words", "cat the dog jumped"));
Thread.sleep(1000);
}
cluster.shutdown();
drpc.shutdown();
} else {
conf.setNumWorkers(3);
StormSubmitter.submitTopology(args[0], conf, buildTopology(null));
}
}
示例13: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String... args) throws Exception {
LocalDRPC drpc = new LocalDRPC();
Config conf = new Config();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology("reach", conf, buildTopology(drpc));
Thread.sleep(2000);
System.out.println("REACH aaa: " + drpc.execute("reach", "aaa"));
System.out.println("REACH foo.com/blog/1: " + drpc.execute("reach", "foo.com/blog/1"));
System.out.println("REACH engineering.twitter.com/blog/5: "
+ drpc.execute("reach", "engineering.twitter.com/blog/5"));
cluster.shutdown();
drpc.shutdown();
}
示例14: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
LinearDRPCTopologyBuilder builder = construct();
Config conf = new Config();
conf.setNumWorkers(6);
if (args.length == 0) {
StormSubmitter.submitTopology(TOPOLOGY_NAME, conf, builder.createRemoteTopology());
}else {
conf.setMaxTaskParallelism(3);
LocalDRPC drpc = new LocalDRPC();
LocalCluster cluster = new LocalCluster();
cluster.submitTopology(TOPOLOGY_NAME, conf, builder.createLocalTopology(drpc));
JStormUtils.sleepMs(50000);
String[] urlsToTry = new String[] { "foo.com/blog/1", "engineering.twitter.com/blog/5", "notaurl.com"};
for(String url: urlsToTry) {
System.out.println("Reach of " + url + ": " + drpc.execute(TOPOLOGY_NAME, url));
}
cluster.shutdown();
drpc.shutdown();
}
}
示例15: main
import backtype.storm.LocalDRPC; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
final Config configuration = new Config();
configuration.put(MapConfiguredCqlClientFactory.TRIDENT_CASSANDRA_CQL_HOSTS, "localhost");
final LocalCluster cluster = new LocalCluster();
LocalDRPC client = new LocalDRPC();
LOG.info("Submitting topology.");
cluster.submitTopology("cqlexample", configuration, buildWordCountAndSourceTopology(client));
LOG.info("Topology submitted.");
Thread.sleep(10000);
LOG.info("DRPC Query: Word Count [cat, dog, the, man]: {}", client.execute("words", "cat dog the man"));
cluster.shutdown();
client.shutdown();
}