zhuguifei
2025-04-28 442928123f63ee497d766f9a7a14f0a6ee067e25
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package org.jeecg.modules.doc.threadpool;
 
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
 
/**
 * 异步线程池配置文件
 */
@Data
@ConfigurationProperties(prefix = "spring.async-thread-pool")
public class AsyncThreadPoolProperties  {
    /**
     * 是否启动异步线程池,默认 false
     */
    private boolean enable;
    /**
     * 核心线程数,默认:Java虚拟机可用线程数
     */
    private Integer corePoolSize=8;
    /**
     * 线程池最大线程数,默认:40000
     */
    private Integer maxPoolSize=500;
    /**
     * 线程队列最大线程数,默认:80000
     */
    private Integer queueCapacity = 5;
 
    /**
     * 线程池中线程最大空闲时间,默认:60,单位:秒
     */
    private Integer keepAliveSeconds = 600;
    /**
     * 自定义线程名前缀,默认:Async-ThreadPool-
     */
    private String threadNamePrefix = "async-threadpool-";
    /**
     * 核心线程是否允许超时,默认false
     */
    private boolean allowCoreThreadTimeOut;
    /**
     * IOC容器关闭时是否阻塞等待剩余的任务执行完成,默认:false(必须设置setAwaitTerminationSeconds)
     */
    private boolean waitForTasksToCompleteOnShutdown;
    /**
     * 阻塞IOC容器关闭的时间,默认:10秒(必须设置setWaitForTasksToCompleteOnShutdown)
     */
    private int awaitTerminationSeconds = 10;
 
}