1
0
mirror of https://github.com/Snailclimb/JavaGuide synced 2025-06-16 18:10:13 +08:00

Merge pull request #2616 from wayne-pq/feature_add_future

add: 增加 Future 的源码参考文章
This commit is contained in:
Guide 2025-02-22 15:33:10 +08:00 committed by GitHub
commit e26afb3739
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -885,6 +885,7 @@ public FutureTask(Runnable runnable, V result) {
`FutureTask`相当于对`Callable` 进行了封装,管理着任务执行的情况,存储了 `Callable``call` 方法的任务执行结果。
关于更多 `Future` 的源码细节,可以肝这篇万字解析,写的很清楚:[Java是如何实现Future模式的万字详解](https://juejin.cn/post/6844904199625375757)。
### CompletableFuture 类有什么用?
`Future` 在实际使用过程中存在一些局限性比如不支持异步任务的编排组合、获取计算结果的 `get()` 方法为阻塞调用。