java中Executors.newFixedThreadPool存储任务有上限吗?
时间: 2023-10-28 16:47:43 浏览: 171
是的,`Executors.newFixedThreadPool` 方法创建一个具有固定线程数的线程池,它会限制同时执行的任务数。该线程池有一个固定大小的线程池,一旦所有线程都正在执行任务,任何新的任务都将等待,直到有一个线程可用来执行它。因此,该线程池中存储任务的数量是有上限的,即线程池的大小。如果任务数大于线程池的大小,那么未来的任务将被放入队列中,等待线程池中的线程完成任务并可用于执行新任务。可以使用 `ThreadPoolExecutor` 类来控制线程池的大小和队列的大小。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![application/x-rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![-](https://img-home.csdnimg.cn/images/20241231045053.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)
![-](https://img-home.csdnimg.cn/images/20241226111658.png)