【发布时间】:2021-09-13 09:16:00
【问题描述】:
CompletableFuture<HttpResponse<String>> completableFuture =
client.sendAsync(request, HttpResponse.BodyHandlers.ofString());
completableFuture
.thenApplyAsync(HttpResponse::headers)
.thenAcceptAsync(System.out::println);
HttpResponse<String> response = completableFuture.join();
sysout("test");
join() 调用后没有打印输出,join 等待完成请求。 为什么?
【问题讨论】:
-
嗯...编辑后的问题与原始问题无关。
-
不要编辑您的帖子以完全改变您的要求,从而使现有答案无效。如果您有新问题,请创建一个新帖子。
标签: java concurrency