We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 49a5eff commit 4d0cdb0Copy full SHA for 4d0cdb0
webmagic-core/src/main/java/us/codecraft/webmagic/Spider.java
@@ -85,7 +85,7 @@ public class Spider implements Runnable, Task {
85
86
protected AtomicInteger stat = new AtomicInteger(STAT_INIT);
87
88
- protected boolean exitWhenComplete = true;
+ protected volatile boolean exitWhenComplete = true;
89
90
protected final static int STAT_INIT = 0;
91
@@ -598,6 +598,13 @@ public void stop() {
598
}
599
600
601
+ /**
602
+ * Stop when all tasks in the queue are completed and all worker threads are also completed
603
+ */
604
+ public void stopWhenComplete(){
605
+ this.exitWhenComplete = true;
606
+ }
607
+
608
/**
609
* start with more than one threads
610
*
0 commit comments