Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
W
webmagic
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
webmagic
Commits
2770811a
Commit
2770811a
authored
Apr 26, 2014
by
yihua.huang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update monitor example
parent
5ecd909e
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
6 deletions
+7
-6
OschinaBlogPageProcessor.java
.../webmagic/processor/example/OschinaBlogPageProcessor.java
+1
-1
MonitorExample.java
...in/java/us/codecraft/webmagic/example/MonitorExample.java
+4
-3
Kr36NewsModel.java
...va/us/codecraft/webmagic/model/samples/Kr36NewsModel.java
+2
-2
No files found.
webmagic-core/src/main/java/us/codecraft/webmagic/processor/example/OschinaBlogPageProcessor.java
View file @
2770811a
...
@@ -34,6 +34,6 @@ public class OschinaBlogPageProcessor implements PageProcessor {
...
@@ -34,6 +34,6 @@ public class OschinaBlogPageProcessor implements PageProcessor {
}
}
public
static
void
main
(
String
[]
args
)
{
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
();
}
}
}
}
webmagic-extension/src/main/java/us/codecraft/webmagic/example/MonitorExample.java
View file @
2770811a
...
@@ -14,17 +14,18 @@ public class MonitorExample {
...
@@ -14,17 +14,18 @@ public class MonitorExample {
public
static
void
main
(
String
[]
args
)
throws
Exception
{
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Spider
oschinaSpider
=
Spider
.
create
(
new
OschinaBlogPageProcessor
())
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
())
Spider
githubSpider
=
Spider
.
create
(
new
GithubRepoPageProcessor
())
.
addUrl
(
"https://github.com/code4craft"
);
.
addUrl
(
"https://github.com/code4craft"
);
SpiderMonitor
spiderMonitor
=
new
SpiderMonitor
();
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();
//If you want to connect it from remote, use spiderMonitor.server().jmxStart();
//ONLY ONE server can start for a machine.
//ONLY ONE server can start for a machine.
//Others will be registered without start a server.
//Others will be registered without start a server.
//You can also register a server by spiderMonitor.client(host,port).jmxStart().
//You can also register a server by spiderMonitor.client(host,port).jmxStart().
spiderMonitor
.
jmxStart
();
spiderMonitor
.
server
().
jmxStart
();
oschinaSpider
.
start
();
oschinaSpider
.
start
();
githubSpider
.
start
();
githubSpider
.
start
();
...
...
webmagic-samples/src/main/java/us/codecraft/webmagic/model/samples/Kr36NewsModel.java
View file @
2770811a
...
@@ -38,9 +38,9 @@ public class Kr36NewsModel {
...
@@ -38,9 +38,9 @@ public class Kr36NewsModel {
}
}
},
Kr36NewsModel
.
class
).
thread
(
20
);
},
Kr36NewsModel
.
class
).
thread
(
20
);
thread
.
run
();
thread
.
start
();
SpiderMonitor
spiderMonitor
=
SpiderMonitor
.
create
();
SpiderMonitor
spiderMonitor
=
SpiderMonitor
.
create
();
spiderMonitor
.
register
(
thread
).
jmxStart
();
spiderMonitor
.
server
().
register
(
thread
).
jmxStart
();
}
}
public
String
getTitle
()
{
public
String
getTitle
()
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment