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