| | |
| | | @Autowired |
| | | private MainProcess mainProcess; |
| | | |
| | | int CRN_COUNT = 0; |
| | | |
| | | public static final Map<CrnThread, Thread> map = new ConcurrentHashMap<>(); |
| | | |
| | | /** |
| | |
| | | |
| | | @Scheduled(cron = "0/3 * * * * ? ") |
| | | public void kill() { |
| | | int i = 0; |
| | | for (Map.Entry<CrnThread, Thread> entry : map.entrySet()) { |
| | | i++; |
| | | MelsecCrnThread key = (MelsecCrnThread) entry.getKey(); |
| | | System.out.println("第"+i+"个堆垛机线程重启线程条件:"+(System.currentTimeMillis() - key.getSign())); |
| | | if (System.currentTimeMillis() - key.getSign() > 120000) { |
| | | System.out.println("第"+i+"个堆垛机线程被重启"); |
| | | CRN_COUNT++; |
| | | SiemensCrnThread key = (SiemensCrnThread) entry.getKey(); |
| | | // System.out.println("第"+i+"个堆垛机线程重启线程条件:"+(System.currentTimeMillis() - key.getSign())); |
| | | if (CRN_COUNT>10000){ |
| | | continue; |
| | | } |
| | | if (System.currentTimeMillis() - key.getSign() > 120000 && System.currentTimeMillis() - key.getSign()<1200000) { |
| | | System.out.println("第"+CRN_COUNT+"个堆垛机线程被重启"); |
| | | |
| | | // 请求线程安全停止 |
| | | key.requestStop(); |