package com.ltkj.web.config.timer;
|
|
|
import com.google.common.util.concurrent.ThreadFactoryBuilder;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Configuration;
|
|
import java.util.concurrent.LinkedBlockingQueue;
|
import java.util.concurrent.ThreadPoolExecutor;
|
import java.util.concurrent.TimeUnit;
|
/**
|
* @Company: 西安路泰科技有限公司
|
* @Author: zjh
|
* @Date: 2023/3/28 11:48
|
*/
|
|
@Configuration
|
@Slf4j
|
public class ThreadPoolConfiguration {
|
|
@Bean(name = "async", destroyMethod = "shutdown")
|
public ThreadPoolExecutor systemCheckPoolExecutorService() {
|
|
return new ThreadPoolExecutor(3, 10, 60, TimeUnit.SECONDS,
|
new LinkedBlockingQueue<Runnable>(10000),
|
new ThreadFactoryBuilder().setNameFormat("default-executor-%d").build(),
|
(r, executor) -> log.error("system pool is full! "));
|
}
|
}
|