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