提交 b6cbe3c8 编写于 作者: L liulei06

commit

上级 a327b639
......@@ -78,18 +78,22 @@ public class AutoRefreshService {
this.getAllArticleUrl();
long i = 1;
while (true){
System.out.println("第" + i + "遍访问开始");
allArticleUrl.parallelStream().forEach(articleUrl -> {
ResponseEntity<String> forEntity = new RestTemplate().getForEntity(articleUrl, String.class);
String msg = forEntity.getStatusCode() == HttpStatus.OK ? "访问成功" : "访问失败";
System.out.println(articleUrl + msg);
});
System.out.println("第" + i + "遍访问结束");
TimeUnit.SECONDS.sleep(sleepSecondNum);
if(i % 10 == 0){
this.getAllArticleUrl();
try {
System.out.println("第" + i + "遍访问开始");
allArticleUrl.parallelStream().forEach(articleUrl -> {
ResponseEntity<String> forEntity = new RestTemplate().getForEntity(articleUrl, String.class);
String msg = forEntity.getStatusCode() == HttpStatus.OK ? "访问成功" : "访问失败";
System.out.println(articleUrl + msg);
});
System.out.println("第" + i + "遍访问结束");
TimeUnit.SECONDS.sleep(sleepSecondNum);
if(i % 10 == 0){
this.getAllArticleUrl();
}
i++;
}catch (Exception e){
System.out.println(e.getMessage());
}
i++;
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册