diff --git a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java index 63025f8..f77334f 100644 --- a/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java +++ b/acs/hd/nladmin-system/src/main/java/org/nl/acs/opc/DeviceOpcProtocolRunable.java @@ -23,6 +23,7 @@ public class DeviceOpcProtocolRunable implements Runnable { String message; int maxResartNum; private Server server; + boolean flag =false; public DeviceOpcProtocolRunable() { this.error_num = 0; @@ -191,11 +192,15 @@ public class DeviceOpcProtocolRunable implements Runnable { runable.setOpcServer(OpcServer); ExecutorService executorService = Executors.newCachedThreadPool(); executorService.submit(runable); - log.warn("opc 值不健康 item: {}, 重新创建连接", item.getId()); + log.warn("opc 值不健康 item: {}, 重新创建连接,当前线程名:{}", item.getId(),tag); + flag = true; break; } } while (ObjectUtil.equal(value, his));//如果两次的值相等,不走下面的代码 + if(flag){ + break; + } OpcItemDto itemDto = this.getItem(item.getId()); //默认记录日志 if (true) { @@ -217,7 +222,12 @@ public class DeviceOpcProtocolRunable implements Runnable { // accessor_value.getHistoryUnifiedData(item.getId()); //设置值 accessor_value.setValue(item.getId(), value); - + if(flag){ + break; + } + } + if(flag){ + break; } } } catch (Exception var30) { @@ -249,6 +259,9 @@ public class DeviceOpcProtocolRunable implements Runnable { this.message = error_message; } } + if(flag){ + break; + } } }