package main import ( commonConfig "cicv-data-closedloop/kinglong/common/cfg" commonInit "cicv-data-closedloop/kinglong/common/init" "cicv-data-closedloop/kinglong/common/log" commonService "cicv-data-closedloop/kinglong/common/svc" masterConfig "cicv-data-closedloop/kinglong/master/pkg/cfg" masterService "cicv-data-closedloop/kinglong/master/pkg/svc" ) func init() { // 初始化日志配置 //runtime.GOMAXPROCS(1) log.InitLogConfig("kinglong-master") commonInit.Init() // 初始化TCP连接,用于发送时间窗口到从节点 masterConfig.InitTcpConfig() // 初始化加载触发器插件文件 masterConfig.InitTriggerConfig() // 初始化rpc监听 commonConfig.InitKillSignalListener(commonConfig.CloudConfig.Hosts[0].Ip) // 等待重启,接收到重启信号,会把信号分发给以下channel go commonService.WaitKillSelf() } func main() { // 1 负责打包数据到data目录 go commonService.BagRecord(commonConfig.CloudConfig.Hosts[0].Name) // 2 启动第4个线程,负责监控故障,并修改timeWindow go masterService.PrepareTimeWindowProducerQueue() // 3 go masterService.RunTimeWindowProducerQueue() // 4 排队运行时间窗口 go commonService.RunTimeWindowConsumerQueue(commonConfig.CloudConfig.Hosts[0].Name) // 阻塞主线程,等待其他线程执行。 select {} }