mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
[Optimize]优化Sonar扫描出的不规范代码
This commit is contained in:
@@ -29,10 +29,7 @@ import com.xiaojukeji.know.streaming.km.core.service.version.metrics.kafka.Clust
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@@ -57,7 +54,6 @@ public class MultiClusterPhyManagerImpl implements MultiClusterPhyManager {
|
||||
false
|
||||
);
|
||||
|
||||
// TODO 后续产品上,看是否需要增加一个未知的状态,否则新接入的集群,因为新接入的集群,数据存在延迟
|
||||
ClusterPhysState physState = new ClusterPhysState(0, 0, clusterPhyList.size());
|
||||
for (ClusterPhy clusterPhy: clusterPhyList) {
|
||||
KafkaController kafkaController = controllerMap.get(clusterPhy.getId());
|
||||
@@ -111,7 +107,6 @@ public class MultiClusterPhyManagerImpl implements MultiClusterPhyManager {
|
||||
// 转为vo格式,方便后续进行分页筛选等
|
||||
List<ClusterPhyDashboardVO> voList = ConvertUtil.list2List(clusterPhyList, ClusterPhyDashboardVO.class);
|
||||
|
||||
// TODO 后续产品上,看是否需要增加一个未知的状态,否则新接入的集群,因为新接入的集群,数据存在延迟
|
||||
// 获取集群controller信息并补充到vo中,
|
||||
Map<Long, KafkaController> controllerMap = kafkaControllerService.getKafkaControllersFromDB(clusterPhyList.stream().map(elem -> elem.getId()).collect(Collectors.toList()), false);
|
||||
for (ClusterPhyDashboardVO vo: voList) {
|
||||
|
||||
@@ -61,7 +61,7 @@ public class GroupMetricCollector extends AbstractMetricCollector<List<GroupMetr
|
||||
|
||||
List<VersionControlItem> items = versionControlService.listVersionControlItem(clusterPhyId, collectorType().getCode());
|
||||
|
||||
FutureWaitUtil<Void> future = getFutureUtilByClusterPhyId(clusterPhyId);
|
||||
FutureWaitUtil<Void> future = this.getFutureUtilByClusterPhyId(clusterPhyId);
|
||||
|
||||
Map<String, List<GroupMetrics>> metricsMap = new ConcurrentHashMap<>();
|
||||
for(String groupName : groups) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.param.cluster;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.param.VersionItemParam;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.xiaojukeji.know.streaming.km.core.service.broker.impl;
|
||||
|
||||
import com.didiglobal.logi.log.ILog;
|
||||
import com.didiglobal.logi.log.LogFactory;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.entity.broker.BrokerSpec;
|
||||
import com.xiaojukeji.know.streaming.km.common.bean.po.config.PlatformClusterConfigPO;
|
||||
import com.xiaojukeji.know.streaming.km.common.enums.config.ConfigGroupEnum;
|
||||
@@ -15,11 +17,11 @@ import java.util.Map;
|
||||
|
||||
@Service
|
||||
public class BrokerSpecServiceImpl implements BrokerSpecService {
|
||||
private static final ILog LOGGER = LogFactory.getLog(BrokerSpecServiceImpl.class);
|
||||
|
||||
@Autowired
|
||||
private PlatformClusterConfigService platformClusterConfigService;
|
||||
|
||||
|
||||
@Override
|
||||
public Map<Integer, BrokerSpec> getBrokerSpecMap(Long clusterPhyId) {
|
||||
//获取规格信息
|
||||
@@ -37,6 +39,4 @@ public class BrokerSpecServiceImpl implements BrokerSpecService {
|
||||
}
|
||||
return brokerSpecMap;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.xiaojukeji.know.streaming.km.common.exception.NotExistException;
|
||||
import com.xiaojukeji.know.streaming.km.common.exception.ParamErrorException;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author didi
|
||||
|
||||
@@ -116,15 +116,16 @@ public class TopicServiceImpl implements TopicService {
|
||||
|
||||
@Override
|
||||
public List<String> listRecentUpdateTopicNamesFromDB(Long clusterPhyId, Integer time) {
|
||||
Date updateTime = DateUtils.getBeforeSeconds(new Date(), time);
|
||||
LambdaQueryWrapper<TopicPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(TopicPO::getClusterPhyId, clusterPhyId);
|
||||
lambdaQueryWrapper.ge(TopicPO::getUpdateTime, updateTime);
|
||||
List<TopicPO> topicPOS = topicDAO.selectList(lambdaQueryWrapper);
|
||||
if (topicPOS.isEmpty()){
|
||||
lambdaQueryWrapper.ge(TopicPO::getClusterPhyId, clusterPhyId);
|
||||
lambdaQueryWrapper.ge(TopicPO::getUpdateTime, DateUtils.getBeforeSeconds(new Date(), time));
|
||||
|
||||
List<TopicPO> poList = topicDAO.selectList(lambdaQueryWrapper);
|
||||
if (poList.isEmpty()){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return topicPOS.stream().map(TopicPO::getTopicName).collect(Collectors.toList());
|
||||
|
||||
return poList.stream().map(elem -> elem.getTopicName()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user