代码更新
This commit is contained in:
@@ -19,10 +19,12 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
||||
OpcServerManageDto OpcServer;
|
||||
int error_num;
|
||||
String message;
|
||||
private Server server;
|
||||
|
||||
public DeviceOpcProtocolRunable() {
|
||||
this.error_num = 0;
|
||||
this.message = null;
|
||||
this.server = null;
|
||||
}
|
||||
|
||||
public List<OpcItemDto> getProtocols() {
|
||||
@@ -60,7 +62,7 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
Server server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
|
||||
this.server = OpcServerUtl.getServerWithOutException(this.OpcServer.getOpc_host(), this.OpcServer.getCls_id(), this.OpcServer.getUser(), this.OpcServer.getPassword(), this.OpcServer.getDomain());
|
||||
// Group group = server.addGroup(this.OpcServer.getOpc_host());
|
||||
Group group = server.addGroup(this.OpcServer.getOpc_code());
|
||||
if(ObjectUtil.isEmpty(group)){
|
||||
@@ -191,6 +193,15 @@ public class DeviceOpcProtocolRunable implements Runnable {
|
||||
}
|
||||
}
|
||||
} catch (Exception var30) {
|
||||
if (this.server != null) {
|
||||
try {
|
||||
this.server.disconnect();
|
||||
} catch (Exception var25) {
|
||||
}
|
||||
}
|
||||
|
||||
this.server = null;
|
||||
|
||||
String error_message = "设备信息同步异常,"+var30;
|
||||
if (!StrUtil.equals(this.message, error_message)) {
|
||||
log.warn("", var30);
|
||||
|
||||
Reference in New Issue
Block a user