CompletableFutureEx
.runAsync(() -> print("one"))
.thenRunAsync(() -> print("two"))
.thenRunWithRetry(500, i -> {
print("three: retry " + i);
return i > 5;
})
.thenWaitMills(1000)
.thenRunAsync(() -> print("four"))
.thenWaitSignal(signal)
.thenRunAsync(() -> print("five"));
完整代码在: https://gist.github.com/haomega/cfae14f47054e36d7c3ae4ac3e7cf90b
还有更好的方法或工具么,目前 cancel 貌似不太方便,不能简单的 cancel 掉一个完整的链路
如果是其他语言( golang )应该怎么写