差異處
這裏顯示兩個版本的差異處。
Both sides previous revision 前次修改 下次修改 | 前次修改 | ||
java:java:java8:concurrent:blockingoperationwithcompletablefuture [2019/01/12 23:28] tony [Improve Blocking Operation of CompletableFuture] |
java:java:java8:concurrent:blockingoperationwithcompletablefuture [2023/06/25 09:48] (目前版本) |
||
---|---|---|---|
行 3: | 行 3: | ||
===== Introduction ===== | ===== Introduction ===== | ||
這陣子在研究CompletableFuture時,剛好看到一篇Oracle關於CompletableFuture如何使用才能有好效能的投影片。我在這裡做了些整理,分享給大家;如果有理解有問題或不足的地方,希望大家可以幫忙更正或補充。本篇圖片都來自於Reference中的投影片。本篇說到五個重點,前四點我會分別說明;第五點如字面上所說,ThreadPool本來就要根據需求而去使用,這裡我不特別探討。 | 這陣子在研究CompletableFuture時,剛好看到一篇Oracle關於CompletableFuture如何使用才能有好效能的投影片。我在這裡做了些整理,分享給大家;如果有理解有問題或不足的地方,希望大家可以幫忙更正或補充。本篇圖片都來自於Reference中的投影片。本篇說到五個重點,前四點我會分別說明;第五點如字面上所說,ThreadPool本來就要根據需求而去使用,這裡我不特別探討。 | ||
- | * Avoid transition task from one thread to another. It costs. | + | * Avoid transition task from one thread to another. It costs. [[.blockingoperationwithcompletablefuture:avoid_transition_task|link]] |
- | * Avoid blocking inside CompletableFuture chains. It costs. [[.blockingoperationwithcompletablefuture:p2|link]] | + | * Avoid blocking inside CompletableFuture chains. It costs. [[.blockingoperationwithcompletablefuture:blocking_inside_cf|link]] |
- | * Carefully avoid transition task from one thread to another. It costs. | + | * Carefully avoid transition task from one thread to another. It costs. [[.blockingoperationwithcompletablefuture:carefully_avoid_transition_task_of_callback|link]] |
- | * It may be useful to build chain of actions before execution. | + | * It may be useful to build chain of actions before execution. [[.blockingoperationwithcompletablefuture:build_chain_before_execution|link]] |
* Different ThreadPools show different performance. | * Different ThreadPools show different performance. | ||
===== Reference ===== | ===== Reference ===== | ||
行 12: | 行 12: | ||
* [[https://www.youtube.com/watch?v=lyJBtg6Dgwc|Asynchronous API with CompletableFuture - Performance Tips and Tricks]] YouTube | * [[https://www.youtube.com/watch?v=lyJBtg6Dgwc|Asynchronous API with CompletableFuture - Performance Tips and Tricks]] YouTube | ||
+ | ====== ====== | ||
+ | ---- | ||
+ | \\ | ||
+ | ~~DISQUS~~ |