rev 更新测试读、写未关闭链接

This commit is contained in:
USER-20220102CG\noblelift
2023-08-16 10:55:06 +08:00
parent 6a8a9c6e40
commit 17fe0e6447
2 changed files with 5 additions and 2 deletions

View File

@@ -1099,6 +1099,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
result.add(json);
}
server.dispose();
return result;
}
@@ -1116,6 +1117,7 @@ public class DeviceServiceImpl implements DeviceService, ApplicationAutoInitial
}
Server server = ReadUtil.getServer(opc_id);
ReadUtil.write(itemMap, server);
server.dispose();
}
/**

View File

@@ -188,6 +188,7 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
Object his = accessor_value.getValue(itemId);
if (!ObjectUtl.isEquals(itemState.getQuality(), QualityTypeValue.OPC_QUALITY_GOOD) && his != null) {
log.warn("opc 值不健康 item: {}, 状态: {}", itemId, itemState.getQuality());
valueAllNotNull = false;
}
if (!UnifiedDataAppService.isEquals(value, his)) {
@@ -227,8 +228,8 @@ public class DeviceOpcProtocolRunable implements Runnable, DataCallback, ServerC
log.warn(tag + "重新创建server");
log.warn("{} 所有内容都为空, all_null:{} ,暂定{}s", tag, all_null,30000 + random);
}
// ThreadUtl.sleep((long) (30000 + random));
ThreadUtl.sleep((long) ((new Random()).nextInt(3) +1) * 1000);
// ThreadUtl.sleep((long) (30000 + random));
ThreadUtl.sleep((long) ((new Random()).nextInt(3) +1) * 10000);
break start;
} else if (this.all_null < 12) {
if (log.isWarnEnabled()) {