【发布时间】:2020-07-15 15:27:53
【问题描述】:
我正在使用java.util.concurrent.ExecutorService,我想知道意外的冗余使用是否会使用更多资源或者只是速度较慢。我的意思是如果我会跑
executor.execute(() -> executor.execute(() -> something());
知道我使用的是 ThreadPool,Executor 会从中选择,我不确定他在执行上述代码后做了什么。
它有不好的副作用还是需要更多资源来执行?
或者Executor如何在池和调用线程之间进行选择?(The command may execute in a new thread, in a pooled thread, or in the calling thread,[..])
问候卢卡斯
【问题讨论】:
-
你从
Executors得到哪个执行者?
标签: java asynchronous executorservice