package com.yxcheng.token.common.threadpool;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;

@Configuration
@EnableAsync
public class TaskThreadPoolConfig {

    @Value("${spring.threadPool.main.corePoolSize}")
    protected int corePoolSize = 10;//线程池维护线程的最少数量

    @Value("${spring.threadPool.main.maxPoolSize}")
    protected int maxPoolSize = 30;//线程池维护线程的最大数量

    @Value("${spring.threadPool.main.queueCapacity}")
    protected int queueCapacity = 8; //缓存队列

    @Value("${spring.threadPool.main.keepAlive}")
    protected int keepAlive = 60;//允许的空闲时间


    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 getKeepAlive() {
        return keepAlive;
    }

    public void setKeepAlive(int keepAlive) {
        this.keepAlive = keepAlive;
    }

}
