|
@@ -46,6 +46,8 @@ import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
import java.util.StringJoiner;
|
|
import java.util.StringJoiner;
|
|
import java.util.UUID;
|
|
import java.util.UUID;
|
|
|
|
+import java.util.concurrent.ExecutorService;
|
|
|
|
+import java.util.concurrent.Executors;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 规则组
|
|
* 规则组
|
|
@@ -101,6 +103,8 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
private final static String PLAN = "plan";
|
|
private final static String PLAN = "plan";
|
|
private final static String CREATIVE = "creative";
|
|
private final static String CREATIVE = "creative";
|
|
|
|
|
|
|
|
+ static ExecutorService executorService = Executors.newFixedThreadPool(5);
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void checkRules() {
|
|
public void checkRules() {
|
|
log.info("------start------");
|
|
log.info("------start------");
|
|
@@ -126,9 +130,11 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
log.error("获取指标内容失败");
|
|
log.error("获取指标内容失败");
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
- for (RuleAccountTemplate templates : ruleAccountTemplates) {
|
|
|
|
|
|
+
|
|
|
|
+ ruleAccountTemplates.forEach(templates -> executorService.submit(() -> {
|
|
matchAlarmRules(ruleGroupMap, indicators, templates);
|
|
matchAlarmRules(ruleGroupMap, indicators, templates);
|
|
- }
|
|
|
|
|
|
+ }));
|
|
|
|
+
|
|
Long endTime = System.currentTimeMillis();
|
|
Long endTime = System.currentTimeMillis();
|
|
log.info("------end------共耗时: {} ms", endTime - startTime);
|
|
log.info("------end------共耗时: {} ms", endTime - startTime);
|
|
}
|
|
}
|
|
@@ -642,7 +648,7 @@ public class RuleGroupServiceImpl extends ServiceImpl<RuleGroupMapper, RuleGroup
|
|
* @throws
|
|
* @throws
|
|
* @author ZHAOXA
|
|
* @author ZHAOXA
|
|
*/
|
|
*/
|
|
- private JSONObject getUserByAccountId(Long accountId) {
|
|
|
|
|
|
+ private synchronized JSONObject getUserByAccountId(Long accountId) {
|
|
JSONObject obj = userObj.getJSONObject(accountId.toString());
|
|
JSONObject obj = userObj.getJSONObject(accountId.toString());
|
|
if (Check.isNull(obj)) {
|
|
if (Check.isNull(obj)) {
|
|
JSONObject user = sysUserMapper.selectUserByAccount(accountId);
|
|
JSONObject user = sysUserMapper.selectUserByAccount(accountId);
|