stopWhenComplete,增加动态修改完成时停止方法。 (#1169)

Co-authored-by: niuxiaozu <niuxiaozu@yeah.net>
pull/1173/head
Niu_XZ 8 months ago committed by GitHub
parent 49a5efff46
commit 4d0cdb011f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -85,7 +85,7 @@ public class Spider implements Runnable, Task {
protected AtomicInteger stat = new AtomicInteger(STAT_INIT);
protected boolean exitWhenComplete = true;
protected volatile boolean exitWhenComplete = true;
protected final static int STAT_INIT = 0;
@ -598,6 +598,13 @@ public class Spider implements Runnable, Task {
}
}
/**
* Stop when all tasks in the queue are completed and all worker threads are also completed
*/
public void stopWhenComplete(){
this.exitWhenComplete = true;
}
/**
* start with more than one threads
*

Loading…
Cancel
Save