美文网首页
CompletableFuture

CompletableFuture

作者: 任嘉平生愿 | 来源:发表于2019-11-15 14:51 被阅读0次

    CompletableFuture 使用详解 - 简书

    两个CompletionStage,任何一个完成了都会执行下一步的操作(Runnable)

    runAfterEither();

    两个异步线程  哪个执行的快 选择哪个(查两个库的表)

    applyToEither();

    thenCombine 将两个异步合在一起处理

    thenCombine();

    对结果处理,和thenApply类似

    handle();

    当一个线程依赖另一个线程时,可以使用 thenApply 方法来把这两个线程串行化。

    thenApply();

    异步结束判断异常

    whenComplete();

    无返回值

    runAsync();

    有返回值

    supplyAsync();

    相关文章

      网友评论

          本文标题:CompletableFuture

          本文链接:https://www.haomeiwen.com/subject/aqjjvctx.html