package com.webmanage.config;
|
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.stereotype.Component;
|
|
@Component
|
@ConfigurationProperties(prefix = "async.executor")
|
public class AsyncExecutorProperties {
|
/** 核心线程数 */
|
private int corePoolSize = 4;
|
/** 最大线程数 */
|
private int maxPoolSize = 8;
|
/** 队列容量 */
|
private int queueCapacity = 200;
|
/** 线程存活时间(秒) */
|
private int keepAliveSeconds = 60;
|
/** 线程名前缀 */
|
private String threadNamePrefix = "async-exec-";
|
/** 关闭时是否等待任务完成 */
|
private boolean waitForTasksToCompleteOnShutdown = true;
|
/** 关闭时最大等待秒数 */
|
private int awaitTerminationSeconds = 30;
|
|
public int getCorePoolSize() { return corePoolSize; }
|
public void setCorePoolSize(int corePoolSize) { this.corePoolSize = corePoolSize; }
|
public int getMaxPoolSize() { return maxPoolSize; }
|
public void setMaxPoolSize(int maxPoolSize) { this.maxPoolSize = maxPoolSize; }
|
public int getQueueCapacity() { return queueCapacity; }
|
public void setQueueCapacity(int queueCapacity) { this.queueCapacity = queueCapacity; }
|
public int getKeepAliveSeconds() { return keepAliveSeconds; }
|
public void setKeepAliveSeconds(int keepAliveSeconds) { this.keepAliveSeconds = keepAliveSeconds; }
|
public String getThreadNamePrefix() { return threadNamePrefix; }
|
public void setThreadNamePrefix(String threadNamePrefix) { this.threadNamePrefix = threadNamePrefix; }
|
public boolean isWaitForTasksToCompleteOnShutdown() { return waitForTasksToCompleteOnShutdown; }
|
public void setWaitForTasksToCompleteOnShutdown(boolean waitForTasksToCompleteOnShutdown) { this.waitForTasksToCompleteOnShutdown = waitForTasksToCompleteOnShutdown; }
|
public int getAwaitTerminationSeconds() { return awaitTerminationSeconds; }
|
public void setAwaitTerminationSeconds(int awaitTerminationSeconds) { this.awaitTerminationSeconds = awaitTerminationSeconds; }
|
}
|