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
be9130f3
Commit
be9130f3
authored
Mar 23, 2018
by
shenjunlin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix bug
parent
cf1b6113
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
13 additions
and
7 deletions
+13
-7
pom.xml
pom.xml
+1
-1
pom.xml
webmagic-core/pom.xml
+1
-1
Spider.java
...agic-core/src/main/java/us/codecraft/webmagic/Spider.java
+3
-0
CountableThreadPool.java
...ava/us/codecraft/webmagic/thread/CountableThreadPool.java
+1
-0
pom.xml
webmagic-extension/pom.xml
+1
-1
pom.xml
webmagic-samples/pom.xml
+1
-1
AnjukeSpider.java
...main/java/us/codecraft/webmagic/samples/AnjukeSpider.java
+3
-1
pom.xml
webmagic-saxon/pom.xml
+1
-1
pom.xml
webmagic-scripts/pom.xml
+1
-1
No files found.
pom.xml
View file @
be9130f3
...
...
@@ -6,7 +6,7 @@
<version>
7
</version>
</parent>
<groupId>
us.codecraft.duiba
</groupId>
<version>
0.7.
8-sjl
-SNAPSHOT
</version>
<version>
0.7.
9-102
-SNAPSHOT
</version>
<modelVersion>
4.0.0
</modelVersion>
<packaging>
pom
</packaging>
<properties>
...
...
webmagic-core/pom.xml
View file @
be9130f3
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.7.
8-sjl
-SNAPSHOT
</version>
<version>
0.7.
9-102
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java
View file @
be9130f3
...
...
@@ -305,6 +305,7 @@ public class Spider implements Runnable, Task {
initComponent
();
logger
.
info
(
"Spider {} started!"
,
getUUID
());
while
(!
Thread
.
currentThread
().
isInterrupted
()
&&
stat
.
get
()
==
STAT_RUNNING
)
{
//while (!Thread.interrupted() && stat.get() == STAT_RUNNING) {
final
Request
request
=
scheduler
.
poll
(
this
);
if
(
request
==
null
)
{
if
(
threadPool
.
getThreadAlive
()
==
0
&&
exitWhenComplete
)
{
...
...
@@ -453,6 +454,7 @@ public class Spider implements Runnable, Task {
Thread
.
sleep
(
time
);
}
catch
(
InterruptedException
e
)
{
logger
.
error
(
"Thread interrupted when sleep"
,
e
);
Thread
.
currentThread
().
interrupt
();
}
}
...
...
@@ -559,6 +561,7 @@ public class Spider implements Runnable, Task {
newUrlCondition
.
await
(
emptySleepTime
,
TimeUnit
.
MILLISECONDS
);
}
catch
(
InterruptedException
e
)
{
logger
.
warn
(
"waitNewUrl - interrupted, error {}"
,
e
);
Thread
.
currentThread
().
interrupt
();
}
finally
{
newUrlLock
.
unlock
();
}
...
...
webmagic-core/src/main/java/us/codecraft/webmagic/thread/CountableThreadPool.java
View file @
be9130f3
...
...
@@ -60,6 +60,7 @@ public class CountableThreadPool {
try
{
condition
.
await
();
}
catch
(
InterruptedException
e
)
{
Thread
.
currentThread
().
interrupt
();
}
}
}
finally
{
...
...
webmagic-extension/pom.xml
View file @
be9130f3
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.7.
8-sjl
-SNAPSHOT
</version>
<version>
0.7.
9-102
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-samples/pom.xml
View file @
be9130f3
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.7.
8-sjl
-SNAPSHOT
</version>
<version>
0.7.
9-102
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-samples/src/main/java/us/codecraft/webmagic/samples/AnjukeSpider.java
View file @
be9130f3
...
...
@@ -86,7 +86,9 @@ public class AnjukeSpider implements PageProcessor {
.
addUrl
(
"https://www.anjuke.com/sy-city.html"
)
// .addUrl("https://lvliang.anjuke.com/community/p1/")
.
thread
(
2
).
addPipeline
(
new
ConsolePipeline
());
anjuke
.
start
();
anjuke
.
run
();
Thread
.
currentThread
().
interrupt
();
}
}
webmagic-saxon/pom.xml
View file @
be9130f3
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.7.
8-sjl
-SNAPSHOT
</version>
<version>
0.7.
9-102
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
webmagic-scripts/pom.xml
View file @
be9130f3
...
...
@@ -3,7 +3,7 @@
<parent>
<groupId>
us.codecraft.duiba
</groupId>
<artifactId>
webmagic-parent
</artifactId>
<version>
0.7.
8-sjl
-SNAPSHOT
</version>
<version>
0.7.
9-102
-SNAPSHOT
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
...
...
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