更新值不健康时处理
This commit is contained in:
@@ -176,11 +176,11 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
value = OpcUtl.getValue(item, itemState);
|
value = OpcUtl.getValue(item, itemState);
|
||||||
his = accessor_value.getValue(item.getId());
|
his = accessor_value.getValue(item.getId());
|
||||||
if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
|
if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
|
||||||
maxResartNum ++;
|
flag = true;
|
||||||
log.warn("线程 {} opc 值不健康 maxResartNum:{} ", tag, maxResartNum);
|
log.warn("线程 {} opc 值不健康 maxResartNum:{} ", tag);
|
||||||
log.warn("opc 值不健康 item: {}, 状态: {},当前读取值:{}, 系统内存值{} ", item.getId(), itemState.getQuality(), value, his);
|
log.warn("线程 {} opc 值不健康 item: {}, 状态: {},当前读取值:{}, 系统内存值{} ", tag, item.getId(), itemState.getQuality(), value, his);
|
||||||
}
|
}
|
||||||
if(maxResartNum>10){
|
if(flag){
|
||||||
if (this.server != null) {
|
if (this.server != null) {
|
||||||
try {
|
try {
|
||||||
this.server.disconnect();
|
this.server.disconnect();
|
||||||
@@ -194,7 +194,6 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
ExecutorService executorService = Executors.newCachedThreadPool();
|
ExecutorService executorService = Executors.newCachedThreadPool();
|
||||||
executorService.submit(runable);
|
executorService.submit(runable);
|
||||||
log.warn("opc 值不健康 item: {}, 重新创建连接,当前线程名:{}", item.getId(),tag);
|
log.warn("opc 值不健康 item: {}, 重新创建连接,当前线程名:{}", item.getId(),tag);
|
||||||
flag = true;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (ObjectUtil.equal(value, his));//如果两次的值相等,不走下面的代码
|
} while (ObjectUtil.equal(value, his));//如果两次的值相等,不走下面的代码
|
||||||
|
|||||||
Reference in New Issue
Block a user