更新线程
This commit is contained in:
@@ -23,6 +23,7 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
String message;
|
String message;
|
||||||
int maxResartNum;
|
int maxResartNum;
|
||||||
private Server server;
|
private Server server;
|
||||||
|
boolean flag =false;
|
||||||
|
|
||||||
public DeviceOpcProtocolRunable() {
|
public DeviceOpcProtocolRunable() {
|
||||||
this.error_num = 0;
|
this.error_num = 0;
|
||||||
@@ -191,11 +192,15 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
runable.setOpcServer(OpcServer);
|
runable.setOpcServer(OpcServer);
|
||||||
ExecutorService executorService = Executors.newCachedThreadPool();
|
ExecutorService executorService = Executors.newCachedThreadPool();
|
||||||
executorService.submit(runable);
|
executorService.submit(runable);
|
||||||
log.warn("opc 值不健康 item: {}, 重新创建连接", item.getId());
|
log.warn("opc 值不健康 item: {}, 重新创建连接,当前线程名:{}", item.getId(),tag);
|
||||||
|
flag = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} while (ObjectUtil.equal(value, his));//如果两次的值相等,不走下面的代码
|
} while (ObjectUtil.equal(value, his));//如果两次的值相等,不走下面的代码
|
||||||
|
|
||||||
|
if(flag){
|
||||||
|
break;
|
||||||
|
}
|
||||||
OpcItemDto itemDto = this.getItem(item.getId());
|
OpcItemDto itemDto = this.getItem(item.getId());
|
||||||
//默认记录日志
|
//默认记录日志
|
||||||
if (true) {
|
if (true) {
|
||||||
@@ -217,7 +222,12 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
// accessor_value.getHistoryUnifiedData(item.getId());
|
// accessor_value.getHistoryUnifiedData(item.getId());
|
||||||
//设置值
|
//设置值
|
||||||
accessor_value.setValue(item.getId(), value);
|
accessor_value.setValue(item.getId(), value);
|
||||||
|
if(flag){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(flag){
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (Exception var30) {
|
} catch (Exception var30) {
|
||||||
@@ -249,6 +259,9 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
|||||||
this.message = error_message;
|
this.message = error_message;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if(flag){
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user