這是本文件的舊版!
CompletableFuture - Avoid transition task from one thread to another. It costs.
Problem
@Test public void transitionTask(){ CompletableFuture<Response> asycRequest = CompletableFuture.supplyAsync(()->{ return new Response(); }); Response reponse = asycRequest.join(); System.out.println(reponse); }
(本篇圖片都來自於link)
How to resolve?
Reference