package com.nokia.domainb;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.CustomizableThreadFactory;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

@Slf4j
@SpringBootApplication
public class DomainBApplication {

    public static void main(String[] args) {
        SpringApplication.run(DomainBApplication.class, args);
    }

    /**
     * 欠费接口整合线程池配置
     */
    @Bean
    public ThreadPoolExecutor qryowefeeExecutor() {
        ThreadPoolExecutor executor = new ThreadPoolExecutor(100, 200, 0L, TimeUnit.MILLISECONDS,
                new ArrayBlockingQueue<>(10000), new CustomizableThreadFactory("qryowefee-"));
        executor.prestartAllCoreThreads();
        log.info("qryowefee poolSize: {}", executor.getPoolSize());
        return executor;
    }
}
