mirror of
https://gitee.com/jd-platform-opensource/asyncTool.git
synced 2026-03-22 12:27:15 +08:00
添加setNextWrapper功能,以丰富功能
This commit is contained in:
@@ -342,6 +342,17 @@ public class WorkerWrapper<T, V> {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 直接set Next
|
||||
*/
|
||||
public WorkerWrapper setNext(WorkerWrapper<?, ?>... workerWrapper) {
|
||||
if (nextWrappers != null) {
|
||||
nextWrappers.clear();
|
||||
}
|
||||
|
||||
return addNext(workerWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置这几个依赖的wrapper不是must执行完毕才能执行自己
|
||||
*/
|
||||
@@ -370,6 +381,12 @@ public class WorkerWrapper<T, V> {
|
||||
if (dependWrappers == null) {
|
||||
dependWrappers = new ArrayList<>();
|
||||
}
|
||||
//如果依赖的是重复的同一个,就不重复添加了
|
||||
for (DependWrapper dependWrapper : dependWrappers) {
|
||||
if (workerWrapper.equals(dependWrapper.getDependWrapper())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
dependWrappers.add(new DependWrapper(workerWrapper, must));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user