浏览代码

CPU任务

master
PoffyZhang 1年前
父节点
当前提交
c9460563e3
共有 1 个文件被更改,包括 12 次插入3 次删除
  1. +12
    -3
      pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/CpuManage.java

+ 12
- 3
pmapi/src/main/java/com/ningdatech/pmapi/sys/manage/CpuManage.java 查看文件

@@ -1,6 +1,5 @@
package com.ningdatech.pmapi.sys.manage;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@@ -11,11 +10,10 @@ import org.springframework.stereotype.Component;
* @Author PoffyZhang
*/
@Component
@AllArgsConstructor
@Slf4j
public class CpuManage {

private volatile Boolean isOpen = Boolean.FALSE;
private Boolean isOpen = Boolean.FALSE;

private int[][] matrix = new int[1][1];

@@ -23,6 +21,7 @@ public class CpuManage {
Double pow = Math.pow(10, i);
matrix = new int[pow.intValue()][pow.intValue()];
this.isOpen = Boolean.TRUE;
whileTrueTask();
}

public void close(){
@@ -36,8 +35,18 @@ public class CpuManage {
for (int i = 0; i < matrix.length; i++) {
for (int j = 0; j < matrix[i].length; j++) {
matrix[i][j] = i * j;
try{
Thread.sleep(10);
if(!isOpen){
break;
}
}catch (InterruptedException e){
log.error(e.getMessage());
}
}
}
}


}
}

正在加载...
取消
保存