update monitor example
parent
5ecd909ef2
commit
2770811a10
|
@ -34,6 +34,6 @@ public class OschinaBlogPageProcessor implements PageProcessor {
|
|||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
Spider.create(new OschinaBlogPageProcessor()).addUrl("http://my.oschina.net/flashsword/blog").thread(2).run();
|
||||
Spider.create(new OschinaBlogPageProcessor()).addUrl("http://my.oschina.net/flashsword/blog").run();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,17 +14,18 @@ public class MonitorExample {
|
|||
public static void main(String[] args) throws Exception {
|
||||
|
||||
Spider oschinaSpider = Spider.create(new OschinaBlogPageProcessor())
|
||||
.addUrl("http://my.oschina.net/flashsword/blog").thread(2);
|
||||
.addUrl("http://my.oschina.net/flashsword/blog");
|
||||
Spider githubSpider = Spider.create(new GithubRepoPageProcessor())
|
||||
.addUrl("https://github.com/code4craft");
|
||||
|
||||
SpiderMonitor spiderMonitor = new SpiderMonitor();
|
||||
spiderMonitor.register(oschinaSpider, githubSpider);
|
||||
spiderMonitor.register(oschinaSpider);
|
||||
spiderMonitor.register(githubSpider);
|
||||
//If you want to connect it from remote, use spiderMonitor.server().jmxStart();
|
||||
//ONLY ONE server can start for a machine.
|
||||
//Others will be registered without start a server.
|
||||
//You can also register a server by spiderMonitor.client(host,port).jmxStart().
|
||||
spiderMonitor.jmxStart();
|
||||
spiderMonitor.server().jmxStart();
|
||||
oschinaSpider.start();
|
||||
githubSpider.start();
|
||||
|
||||
|
|
|
@ -38,9 +38,9 @@ public class Kr36NewsModel {
|
|||
|
||||
}
|
||||
}, Kr36NewsModel.class).thread(20);
|
||||
thread.run();
|
||||
thread.start();
|
||||
SpiderMonitor spiderMonitor = SpiderMonitor.create();
|
||||
spiderMonitor.register(thread).jmxStart();
|
||||
spiderMonitor.server().register(thread).jmxStart();
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
|
|
Loading…
Reference in New Issue