AI写作智能体 自主规划任务,支持联网查询和网页读取,多模态高效创作各类分析报告、商业计划、营销方案、教学内容等。 广告
``` java.util.concurrent.ThreadPoolExecutor 有4个构造方法,选取最多参数的那个来讲解 ``` **构造方法:** ``` public ThreadPoolExecutor( int corePoolSize, //核心线程池大小 int maximumPoolSize, //最大线程池大小 long keepAliveTime, //线程最大空闲时间 TimeUnit unit, //时间单位 BlockingQueue<Runnable> workQueue, //线程等等队列 ThreadFactory threadFactory, //线程创建工厂 RejectedExecutionHandler handler //拒绝策略 ) ``` **预定义线程池:** ``` ExecutorService newFixedThreadPool = Executors.newFixedThreadPool(1); ExecutorService newCachedThreadPool = Executors.newCachedThreadPool(); ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor(); ScheduledExecutorService scheduledExecutorService = Executors.newScheduledThreadPool(1); ```