Return spider in setEmptySleepTime itself for chainning.

master
Joe Zhou 2022-11-12 11:06:08 +08:00
parent ac912e8f1f
commit 075b98291b
1 changed files with 6 additions and 3 deletions

View File

@ -333,9 +333,10 @@ public class Spider implements Runnable, Task {
}
} else {
// wait until new url added
if (waitNewUrl())
//if interrupted
if (waitNewUrl()) {
//if interrupted
break;
}
continue;
}
}
@ -805,11 +806,13 @@ public class Spider implements Runnable, Task {
* Set wait time when no url is polled.<br><br>
*
* @param emptySleepTime In MILLISECONDS.
* @return this
*/
public void setEmptySleepTime(long emptySleepTime) {
public Spider setEmptySleepTime(long emptySleepTime) {
if(emptySleepTime<=0){
throw new IllegalArgumentException("emptySleepTime should be more than zero!");
}
this.emptySleepTime = emptySleepTime;
return this;
}
}