更新线程

This commit is contained in:
USER-20220102CG\noblelift
2023-03-30 15:38:42 +08:00
parent 3510d2a3ee
commit 7853266c53

View File

@@ -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;
}
}
}