package com.gyee.alarm;


import com.gyee.alarm.service.AlarmScannerService;

import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Resource;

@Slf4j
@Component
public class CalculateServer {

    @Resource
    AlarmScannerService alarmScannerService;
    private boolean serverStarted = false;
    public boolean start() {

        if (serverStarted) {
            return true;
        }
        try {
            //GlobalVar.config = configProperties;
            log.warn("警计算服务启动...... ");
            log.info("开始加载配置及测点数据......");
            alarmScannerService.init();

            alarmScannerService.taskJobs();
            serverStarted = true;
        } catch (Exception ex) {
            serverStarted = false;
            log.error(ex.getMessage());
            return false;
        }
        return true;
    }

}
