小编Chr*_* S.的帖子

使用 CompletableFuture.runAsync() 与 ForkJoinPool.execute()

不传递Executorto CompletableFuture.runAsync()ForkJoinPool则使用公共。相反,对于我想要异步执行的简单任务(例如,我不需要链接不同的任务),我可能只使用ForkJoinPool.commonPool().execute().

为什么应该优先考虑另一个?例如,是否runAsync()有任何实质性的开销execute()?前者比后者有什么特别的优势吗?

java multithreading asynchronous forkjoinpool completable-future

4
推荐指数
1
解决办法
709
查看次数