增加查看进度
This commit is contained in:
parent
faaf570b22
commit
92d16479ef
@ -25,6 +25,10 @@ public class KpiUpdateMonitor {
|
|||||||
completeTaskCount.getAndAdd(1);
|
completeTaskCount.getAndAdd(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getCompleteCount() {
|
||||||
|
return completeTaskCount.get();
|
||||||
|
}
|
||||||
|
|
||||||
public double getPercent() {
|
public double getPercent() {
|
||||||
LOG.debug("task: {}, complete: {}", taskCount, completeTaskCount);
|
LOG.debug("task: {}, complete: {}", taskCount, completeTaskCount);
|
||||||
if (taskCount == 0) {
|
if (taskCount == 0) {
|
||||||
|
@ -45,7 +45,7 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
|||||||
private KpiKhxzWgzTask kpiKhxzWgzTask;
|
private KpiKhxzWgzTask kpiKhxzWgzTask;
|
||||||
@Autowired
|
@Autowired
|
||||||
private KpiKhxzZnbmTask kpiKhxzZnbmTask;
|
private KpiKhxzZnbmTask kpiKhxzZnbmTask;
|
||||||
private ExecutorService executorService = Executors.newFixedThreadPool(2);
|
private ExecutorService executorService = Executors.newFixedThreadPool(10);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update(Integer khYear, Integer khMonth) {
|
public void update(Integer khYear, Integer khMonth) {
|
||||||
@ -95,13 +95,21 @@ public class KpiKhxzServiceImpl extends AbstractService implements IKpiKhxzServi
|
|||||||
});
|
});
|
||||||
|
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
// 网格长,3任务
|
// 职能部门,4任务
|
||||||
kpiKhxzWgzTask.update(khYear, khMonth);
|
kpiKhxzZnbmTask.update(khYear, khMonth);
|
||||||
});
|
});
|
||||||
|
|
||||||
executorService.execute(() -> {
|
executorService.execute(() -> {
|
||||||
// 职能部门,4任务
|
while(KpiUpdateMonitor.getInstance().getCompleteCount() < 26) {
|
||||||
kpiKhxzZnbmTask.update(khYear, khMonth);
|
try {
|
||||||
|
Thread.sleep(3000);
|
||||||
|
LOG.debug("等待其他任务执行完成");
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 网格长,3任务
|
||||||
|
kpiKhxzWgzTask.update(khYear, khMonth);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user