package com.gic.haoban.manage.service.util;

import com.ctrip.framework.apollo.Config;
import com.ctrip.framework.apollo.ConfigService;

import java.util.Map;

public class ApolloUtils {
    
    /**
     * 旧的调用发送，是否采用新的消息中心开关1：是 0：否
     * @return
     */
    public static boolean useMessageCenter() {
        Config config = ConfigService.getConfig("COMMON.gic-properties");
        String messageCenterSwitch = config.getProperty("messageCenterSwitch", "0");
        return "1".equals(messageCenterSwitch);
    }

    /**
     * 线程池核心线程数
     * @return
     */
    public static Integer combinedCorePoolSize() {
        Config config = ConfigService.getAppConfig();
        String corePoolSize = config.getProperty("combinedCorePoolSize", "20");
        return Integer.parseInt(corePoolSize);
    }

    /**
     * 线程池最大线程数
     * @return
     */
    public static Integer combinedMaximumPoolSize() {
        Config config = ConfigService.getAppConfig();
        String maximumPoolSize = config.getProperty("combinedMaximumPoolSize", "40");
        return Integer.parseInt(maximumPoolSize);
    }
}
