1.增加配网用户侧算法适配

2.新增河北用户侧数据完整性接口
3.新增河北用户侧越限详情接口
This commit is contained in:
2024-09-04 16:47:08 +08:00
parent ed10b12e79
commit 9fca0e5714
29 changed files with 818 additions and 25 deletions

View File

@@ -172,6 +172,42 @@ public class ConfigController extends BaseController {
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
@GetMapping("/系统扩容操作")
@ApiOperation("系统扩容操作")
public HttpResult addMemory(@RequestParam("size")Integer sizeInMB) {
String methodDescribe = getMethodDescribe("addMemory");
try {
// 将MB转换为字节
long sizeInBytes = sizeInMB * 1024 * 1024;
// 分配一个足够大的byte数组
byte[] memory = new byte[(int) sizeInBytes];
// 为了确保JVM不会优化掉这个内存分配因为它可能认为这个变量未使用
// 我们可以对数组进行简单的操作,比如填充数据
for (int i = 0; i < memory.length; i++) {
memory[i] = (byte) (i % 256); // 简单的数据填充
}
// 实际上,你可能不需要对数组进行填充,因为仅仅是分配就足以占用内存。
// 但填充可以确保内存被实际使用而不是被JVM优化掉。
// 注意这里有一个int类型的限制因为数组长度是int类型。
// 如果你需要分配超过Integer.MAX_VALUE字节的内存你将需要找到其他方法比如使用多个数组
System.out.println("Allocated approximately " + sizeInMB + " MB of memory.");
// 为了让效果更明显,你可以尝试保持这个引用,或者让这个方法运行足够长的时间
// 以便你可以观察JVM的行为比如使用jconsole或jvisualvm等工具
// 注意:在实际应用中,你应该在不再需要时释放这个引用,以避免内存泄漏。
} catch (OutOfMemoryError e) {
System.err.println("Failed to allocate memory: " + e.getMessage());
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
}
}