Java线程池理解
2021/11/2 14:10:00
本文主要是介绍Java线程池理解,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
线程池理解
线程池的构造函数:
- corePoolSize: the number of threads to keep in the pool, even if they are idle, unless {@code allowCoreThreadTimeOut} is set(线程池中活跃的线程数,即使他们是空闲的,没有任务可以执行的,也不会销毁,除非设置 allowCoreThreadTimeOut)
- maximumPoolSize: the maximum number of threads to allow in the pool(线程池中允许的最大线程数量)
- keepAliveTime: when the number of threads is greater than the core, this is the maximum time that excess idle threads will wait for new tasks before terminating.(当线程的数量大于核心线程数的时候,空闲的线程在他们销毁到等待新的任务到来,这段时间的最大值)
- unit: the time unit for the {@code keepAliveTime} argument(keepAliveTime 的时间单位)
- workQueue: the queue to use for holding tasks before they are executed. This queue will hold only the {@code Runnable} tasks submitted by the {@code execute} method.(任务执行之前保存任务的队列,该队列将只保存由{@code execute}方法提交的{@code Runnable}任务)
- threadFactory: the factory to use when the executor creates a new thread(执行程序创建新线程时要使用的工厂)
- handler:the handler to use when execution is blocked because the thread bounds and queue capacities are reached(当执行因达到线程边界和队列容量而阻塞时要使用的处理程序)
这篇关于Java线程池理解的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-14动态路由项目实战:从入门到上手
- 2024-11-14函数组件项目实战:从入门到简单应用
- 2024-11-14获取参数项目实战:新手教程与案例分析
- 2024-11-14可视化开发项目实战:新手入门教程
- 2024-11-14可视化图表项目实战:从入门到实践
- 2024-11-14路由懒加载项目实战:新手入门教程
- 2024-11-14路由嵌套项目实战:新手入门教程
- 2024-11-14全栈低代码开发项目实战:新手入门指南
- 2024-11-14全栈项目实战:新手入门教程
- 2024-11-14useRequest教程:新手快速入门指南