1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- package com.fdkankan.modeling.constants;
- import com.fdkankan.common.util.FileUtils;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.concurrent.ExecutorService;
- import java.util.concurrent.Executors;
- import org.slf4j.Logger;
- import org.slf4j.LoggerFactory;
- import org.springframework.beans.factory.annotation.Value;
- import org.springframework.stereotype.Component;
- @Component
- public class SysConstants {
- private static final Logger log = LoggerFactory.getLogger(SysConstants.class);
- public static String hostName;
- public static int modelTimeOut;
- public static List<String> residenceServiceHostName = new ArrayList<>();
- public static volatile Boolean SYSTEM_BUILDING = false;
- public static volatile Boolean SYSTEM_OFFING = false;
- public static ExecutorService executorService = Executors.newFixedThreadPool(1);
- public static final String DINGTALK_MSG_PATTERN = "**环境**: %s\n\n" +
- "**服务器名称**: %s\n\n" +
- "**失败原因**: %s\n\n" +
- "**num**: %s\n\n" +
- "**server-path**: %s\n\n" +
- "**algorithm-log**: [https://4dkk.4dage.com/build_log/%s/console.log](https://4dkk.4dage.com/build_log/%s/console.log)";
- @Value("${hostName.filePath:/opt/hosts/hosts.txt}")
- public void setHostName(String filePath){
- try {
- SysConstants.hostName = FileUtils.readFile(filePath);
- log.error("从文件({})中获取服务器名称:{}", filePath,hostName);
- } catch (Exception e) {
- log.error("从文件中获取服务器名称失败,文件路径{}", filePath);
- e.printStackTrace();
- }
- }
- /**
- * 默认超时时间2天
- * @param timeOut
- */
- @Value("${model.timeOut:48}")
- public void setModelTimeOut(int timeOut){
- SysConstants.modelTimeOut = timeOut;
- }
- }
|