package com.jay.monitor.data.server.ext.springboot;

import com.alipay.remoting.config.ConfigManager;
import com.jay.monitor.data.server.store.SplitDataManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;

/**
 * @Module 启动
 * @Description 启动时, 希望做某些事情
 * @Author liukaixiong
 * @Date 2020/11/6 16:52
 */
@Component
public class RunApplication implements ApplicationRunner {

    private Logger logger = LoggerFactory.getLogger(getClass());

    @Autowired
    private SplitDataManager splitDataManager;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        // 希望在启动的时候，能够尝试先创建一下表，即便已经存在。
        splitDataManager.initFirstProcess();
        logger.info("比较关键的一些性能参数:");
        logger.info("核心线最小程池" + ConfigManager.default_tp_min_size());
        logger.info("核心线最大程池大小" + ConfigManager.default_tp_max_size());
        logger.info("等待队列大小" + ConfigManager.default_tp_queue_size());
    }
}
