You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
|
package com.glxp.api.config;
|
|
|
|
|
|
|
|
|
|
import lombok.Data;
|
|
|
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
|
|
|
|
|
|
|
|
|
// 1. 创建配置类(建议放在config包下)
|
|
|
|
|
@ConfigurationProperties(prefix = "thread.pool")
|
|
|
|
|
@Data
|
|
|
|
|
public class ThreadPoolConfigProperties {
|
|
|
|
|
/**
|
|
|
|
|
* 核心线程数(默认CPU核心数)
|
|
|
|
|
*/
|
|
|
|
|
private Integer corePoolSize;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 最大线程数(默认CPU核心数*2)
|
|
|
|
|
*/
|
|
|
|
|
private Integer maxPoolSize;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 队列容量(默认200)
|
|
|
|
|
*/
|
|
|
|
|
private int queueCapacity = 200;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 线程空闲时间(秒,默认60)
|
|
|
|
|
*/
|
|
|
|
|
private int keepAliveSeconds = 60;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 线程名前缀(默认"custom_executor_")
|
|
|
|
|
*/
|
|
|
|
|
private String threadNamePrefix = "custom_executor_";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|