自动化立体仓库 - WCS系统
#
lsh
2024-01-16 d9131e43a1fa8fe4d5e086d02d4037997cb13bde
src/main/java/com/zy/core/ServerBootstrap.java
@@ -32,6 +32,8 @@
    @Autowired
    private MainProcess mainProcess;
    int CRN_COUNT = 0;
    public static final Map<CrnThread, Thread> map = new ConcurrentHashMap<>();
@@ -142,13 +144,15 @@
        @Scheduled(cron = "0/3 * * * * ? ")
        public void kill() {
            int i = 0;
            for (Map.Entry<CrnThread, Thread> entry : map.entrySet()) {
                i++;
                CRN_COUNT++;
                SiemensCrnThread key = (SiemensCrnThread) entry.getKey();
//                System.out.println("第"+i+"个堆垛机线程重启线程条件:"+(System.currentTimeMillis() - key.getSign()));
                if (System.currentTimeMillis() - key.getSign() > 120000) {
                    System.out.println("第"+i+"个堆垛机线程被重启");
                if (CRN_COUNT>10000){
                    continue;
                }
                if (System.currentTimeMillis() - key.getSign() > 120000 && System.currentTimeMillis() - key.getSign()<1200000) {
                    System.out.println("第"+CRN_COUNT+"个堆垛机线程被重启");
                    // 请求线程安全停止
                    key.requestStop();