Skip to content

Commit 63a31fa

Browse files
authored
Update 24-Concurrent-Programming.md (#584)
> ”the blocking never happens because the CompletableFuture is already complete, so the answer is instantly available.“ 1. 笔误 2. answer这里应该是指结果
1 parent 004ebc9 commit 63a31fa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/book/24-Concurrent-Programming.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1439,7 +1439,7 @@ public class CompletedMachina {
14391439

14401440
**completedFuture()** 创建一个“已经完成”的 **CompletableFuture** 。对这样一个未来做的唯一有用的事情是 **get()** 里面的对象,所以这看起来似乎没有用。注意 **CompletableFuture** 被输入到它包含的对象。这个很重要。
14411441

1442-
通常,**get()** 在等待结果时阻塞调用线程。此块可以通过 **InterruptedException****ExecutionException** 中断。在这种情况下,阻止永远不会发生,因为 CompletableFutureis 已经完成,所以答案立即可用
1442+
通常,**get()** 在等待结果时阻塞调用线程。此块可以通过 **InterruptedException****ExecutionException** 中断。在这种情况下,阻止永远不会发生,因为 **CompletableFuture** 已经完成,所以结果立即可用
14431443

14441444
当我们将 **handle()** 包装在 **CompletableFuture** 中时,发现我们可以在 **CompletableFuture** 上添加操作来处理所包含的对象,使得事情变得更加有趣:
14451445

0 commit comments

Comments
 (0)