Merge remote-tracking branch 'origin/master'

This commit is contained in:
wuweifeng10 2020-03-23 14:24:44 +08:00
commit 1c39d5853e
3 changed files with 131 additions and 105 deletions

View File

@ -61,9 +61,6 @@ wrapper的泛型和worker的一样决定了入参和结果的类型。
WorkerWrapper<String, String> workerWrapper2 = new WorkerWrapper<>(w2, "2", w2);
WorkerWrapper<String, String> workerWrapper3 = new WorkerWrapper<>(w3, "3", w3);
workerWrapper.addNext(workerWrapper1, workerWrapper2);
workerWrapper1.addNext(workerWrapper3);
workerWrapper2.addNext(workerWrapper3);
```
@ -72,7 +69,7 @@ wrapper的泛型和worker的一样决定了入参和结果的类型。
0执行完,同时1和2, 1\2都完成后3。3会等待2完成
譬如,你可以定义一个 **worker**
此时,你可以定义一个 **worker**
```
/**
@ -167,7 +164,6 @@ public class ParWorker1 implements IWorker<String, String>, ICallback<String, St
```
2. 1个执行完毕后开启另外两个另外两个执行完毕后开始第4个
![输入图片说明](https://images.gitee.com/uploads/images/2019/1226/140405_93800bc7_303698.png "屏幕截图.png")
@ -219,6 +215,40 @@ public class ParWorker1 implements IWorker<String, String>, ICallback<String, St
Async.shutDown();
```
如果觉得这样不符合左右的顺序,也可以用这种方式:
```
WorkerWrapper<String, String> workerWrapper = new WorkerWrapper.Builder<String, String>()
.worker(w)
.callback(w)
.param("0")
.build();
WorkerWrapper<String, String> workerWrapper3 = new WorkerWrapper.Builder<String, String>()
.worker(w3)
.callback(w3)
.param("3")
.build();
WorkerWrapper<String, String> workerWrapper2 = new WorkerWrapper.Builder<String, String>()
.worker(w2)
.callback(w2)
.param("2")
.depend(workerWrapper)
.next(workerWrapper3)
.build();
WorkerWrapper<String, String> workerWrapper1 = new WorkerWrapper.Builder<String, String>()
.worker(w1)
.callback(w1)
.param("1")
.depend(workerWrapper)
.next(workerWrapper3)
.build();
```
3. 复杂点的
![输入图片说明](https://images.gitee.com/uploads/images/2019/1226/140445_8d52e4d6_303698.png "屏幕截图.png")

View File

@ -91,7 +91,6 @@
At this time, the traditional can do nothing.
My framework provides such a callback function. In addition, if the execution fails or times out, the default value can be set when defining the execution unit.
@ -135,5 +134,3 @@
####Possible requirements for concurrent scenarios -- timeout of the whole group of tasks
For a group of tasks, although the time of each internal execution unit is not controllable, I can control that the execution time of the whole group does not exceed a certain value. Control the execution threshold of the whole group by setting timeout.

View File

@ -105,7 +105,6 @@
**该框架支持后面的执行单元以前面的执行单元的结果为自己的入参** 。譬如你的执行单元B的入参是ResultAResultA就是A的执行结果那也可以支持。在编排时就可以预先设定B或C的入参为A的result即便此时A尚未开始执行。当A执行完毕后自然会把结果传递到B的入参去。
**该框架全程无锁。**
## 快速开始
[点此开启实战](https://gitee.com/tianyalei/asyncTool/blob/master/QuickStart.md)