#
luxiaotao1123
2020-08-04 34e454267496aea7721b50e50025e5d55b9a3a32
src/main/java/com/zy/core/ServerBootstrap.java
@@ -1,7 +1,10 @@
package com.zy.core;
import com.alibaba.fastjson.JSON;
import com.core.common.Cools;
import com.zy.core.properties.SlaveProperties;
import com.zy.core.thread.CrnThread;
import com.zy.core.thread.DevpThread;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -22,10 +25,30 @@
    @PostConstruct
    public void init(){
        System.out.println(JSON.toJSONString(slaveProperties));
        // 初始化下位机线程
        initThread();
    }
    private void initThread(){
        // 初始化堆垛机线程
        if (!Cools.isEmpty(slaveProperties.getCrn())) {
            for (Slave crn : slaveProperties.getCrn()) {
                CrnThread crnThread = new CrnThread(crn);
                new Thread(crnThread).start();
            }
        }
//        // 初始化站点线程
//        if (!Cools.isEmpty(slaveProperties.getDevp())) {
//            for (Slave devo : slaveProperties.getDevp()) {
//                DevpThread devpThread = new DevpThread(crn);
//                new Thread(devpThread).start();
//            }
//        }
    }
    @PreDestroy
    public void destroy() {
    }