<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ThinkChat2.0新版上線,更智能更精彩,支持會話、畫圖、視頻、閱讀、搜索等,送10W Token,即刻開啟你的AI之旅 廣告
                # whenComplete ``` CompletableFuture<Integer> future = CompletableFuture.supplyAsync(() -> { int i = 10/ 0; return i; }, executor).whenComplete((res, excption) -> { // 可以得到異常, 當時沒法修改返回數據 }).exceptionally(throwable -> { // 可以得到異常, 同時返回默認值 return 666; }); ``` # handle ``` CompletableFuture<Integer> future = CompletableFuture.supplyAsync(() -> { return i; }, executor).handle((res, excption) -> { // 可以得到異常, 當時沒法修改返回數據 if(res != null) { // 沒有錯誤,直接返回 return res * 10; } if (excption!= null) { // 有錯誤,直接返回 0 return 0; } return 0; }); ``` # 線程串行化方法 帶 async 結尾的, 表示另起一個線程, 這些都要前一個任務執行完成 // 會使用上一步的執行結果, 而且有返回值, 可以讓下一步得到這一步返回結果 thenApply thenApplyAsync // 會使用上一步的執行結果, 但是自己沒有返回值,無法讓下一步得到這一步返回結果 thenAccept thenAcceptAsync // 不使用上一步的返回結果, 自己也沒有返回值,無法讓下一步得到這一步返回結果 thenRun thenRunAsync # 兩任務都要完成 thenCombine # 兩任務任意完成一個 applyToEither:兩個任務有一個執行完成,獲取它的返回值,處理任務并有新的返回值。 acceptlither:兩個任務有一個執行完成,獲取它的返回值,處理任務,沒有新的返回值。 runAfterEither:兩個任務有一個執行完成,不需要獲取future的結果,處理任務,也沒有返回值。
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看