mirror of
https://gitee.com/jd-platform-opensource/asyncTool.git
synced 2026-03-22 04:27:15 +08:00
chore: 简化判断
This commit is contained in:
@@ -136,10 +136,8 @@ public class Async {
|
||||
//任务结束就退出检查
|
||||
if (onceWork.isFinish()) {
|
||||
break;
|
||||
}
|
||||
//完成或者取消就及时取消任务
|
||||
if (!onceWork.isFinish()
|
||||
&& onceWork.getAllThreadSubmit().stream().allMatch(future -> future.isDone() || future.isCancelled())) {
|
||||
} else if (onceWork.getAllThreadSubmit().stream().allMatch(future -> future.isDone() || future.isCancelled())) {
|
||||
//完成或者取消就及时取消任务
|
||||
if (!onceWork.isCancelled() && !onceWork.isWaitingCancel()) {
|
||||
onceWork.pleaseCancel();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user