| | |
| | | //1.根据数据库设备表加载数据 得到全部 设备信息 |
| | | List<Machine> listMachine = machineService.getMachineConfig(); |
| | | //2.根据设备配置进行加载多线程 |
| | | for (int i = 1; i < listMachine.size(); i++) |
| | | try { |
| | | Machine machine = listMachine.get(i); |
| | | Thread thread = new Thread(new MachineThread(machine, api)); |
| | | thread.start(); |
| | | thread.setName(machine.getName()); |
| | | } catch (Exception e) { |
| | | // TODO: handle exception |
| | | System.out.println("多线程异常!!"); |
| | | //2.根据设备配置进行加载多线程 |
| | | for (int i = 0; i < listMachine.size(); i++){ |
| | | if("ON".equals(listMachine.get(i).getOpen()) ){ |
| | | try { |
| | | Machine machine = listMachine.get(i); |
| | | Thread thread = new Thread(new MachineThread(machine, api)); |
| | | thread.start(); |
| | | thread.setName(machine.getName()); |
| | | } catch (Exception e) { |
| | | // TODO: handle exception |
| | | System.out.println("多线程异常!!"); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |