添加日志
parent
dc9e8b02e2
commit
fdb4fb810d
|
@ -435,16 +435,12 @@ public class ModuleServiceImpl implements ModuleService {
|
||||||
log.info("rootGroups:{}", JSON.toJSONString(rootGroups));
|
log.info("rootGroups:{}", JSON.toJSONString(rootGroups));
|
||||||
log.info("context:{}", JSON.toJSONString(context));
|
log.info("context:{}", JSON.toJSONString(context));
|
||||||
|
|
||||||
//用countDownLatch是为了加快速度
|
|
||||||
CountDownLatch countDownLatch = new CountDownLatch(rootGroups.size());
|
|
||||||
|
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
||||||
for (ModuleGroup rootGroup : rootGroups) {
|
for (ModuleGroup rootGroup : rootGroups) {
|
||||||
//获取每个模型的所有实例总数
|
//获取每个模型的所有实例总数
|
||||||
getInstaceCount(rootGroup, resultMap, countDownLatch, context.getTarget());
|
getInstaceCount(rootGroup, resultMap, context.getTarget());
|
||||||
}
|
}
|
||||||
countDownLatch.await();
|
|
||||||
|
|
||||||
//查询云主机总数
|
//查询云主机总数
|
||||||
Pager pager = new Pager();
|
Pager pager = new Pager();
|
||||||
|
@ -471,18 +467,14 @@ public class ModuleServiceImpl implements ModuleService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getInstaceCount(ModuleGroup rootGroup, Map<String, Object> resultMap, CountDownLatch countDownLatch, Long userId) {
|
private void getInstaceCount(ModuleGroup rootGroup, Map<String, Object> resultMap, Long userId) throws Exception {
|
||||||
new Thread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
try {
|
|
||||||
log.info("rootGroup:{}", JSON.toJSONString(rootGroup));
|
log.info("rootGroup:{}", JSON.toJSONString(rootGroup));
|
||||||
//获取当前ModuleGroup下所有的modle
|
//获取当前ModuleGroup下所有的modle
|
||||||
Pager pager = new Pager();
|
Pager pager = new Pager();
|
||||||
GeneralResult<GridBean<CiModule>> modelList = getModelList(pager);
|
GeneralResult<GridBean<CiModule>> modelList = getModelList(pager);
|
||||||
if (modelList.isFailed()) {
|
if (modelList.isFailed()) {
|
||||||
log.info("modelList:{}", JSON.toJSONString(modelList));
|
log.info("modelList:{}", JSON.toJSONString(modelList));
|
||||||
countDownLatch.countDown();
|
throw new Exception("查询实例失败");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Integer total = 0;
|
Integer total = 0;
|
||||||
|
@ -501,12 +493,6 @@ public class ModuleServiceImpl implements ModuleService {
|
||||||
total += count;
|
total += count;
|
||||||
}
|
}
|
||||||
resultMap.put(rootGroup.getCode(), total);
|
resultMap.put(rootGroup.getCode(), total);
|
||||||
} catch (Exception e) {
|
|
||||||
log.info("查询失败", e);
|
|
||||||
}
|
|
||||||
countDownLatch.countDown();
|
|
||||||
}
|
|
||||||
}).start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private GeneralResult baseModifyProperty(Long moduleId, List<PropertyGroup> groups, List<Property> properties,
|
private GeneralResult baseModifyProperty(Long moduleId, List<PropertyGroup> groups, List<Property> properties,
|
||||||
|
|
Loading…
Reference in New Issue