Skip to content

Commit cd2c388

Browse files
author
zengqiao
committed
[Optimize]优化Sonar代码扫描结果
1 parent 4543a33 commit cd2c388

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

km-core/src/main/java/com/xiaojukeji/know/streaming/km/core/service/connect/connector/impl/ConnectorMetricServiceImpl.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,13 +392,13 @@ private Result<ConnectorTaskMetrics> getConnectorTaskMetric(Long connectClusterI
392392
}
393393

394394
private List<Tuple<Long, String>> listTopNConnectorList(Long clusterPhyId, Integer topN) {
395-
List<ConnectorPO> connectorPOS = connectorService.listByKafkaClusterIdFromDB(clusterPhyId);
395+
List<ConnectorPO> poList = connectorService.listByKafkaClusterIdFromDB(clusterPhyId);
396396

397-
if (CollectionUtils.isEmpty(connectorPOS)) {
397+
if (CollectionUtils.isEmpty(poList)) {
398398
return new ArrayList<>();
399399
}
400400

401-
return connectorPOS.subList(0, Math.min(topN, connectorPOS.size()))
401+
return poList.subList(0, Math.min(topN, poList.size()))
402402
.stream()
403403
.map( c -> new Tuple<>(c.getId(), c.getConnectorName()) )
404404
.collect(Collectors.toList());

km-core/src/main/java/com/xiaojukeji/know/streaming/km/core/service/topic/impl/TopicMetricServiceImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ public Result<List<MetricMultiLinesVO>> listTopicMetricsFromES(Long clusterId, M
185185
Table<String/*metric*/, String/*topics*/, List<MetricPointVO>> retTable;
186186
if(CollectionUtils.isEmpty(topics)) {
187187
//如果 es 中获取不到topN的topic就使用从数据库中获取的topics
188-
List<String> defaultTopics = listTopNTopics(clusterId, topN);
188+
List<String> defaultTopics = this.listTopNTopics(clusterId, topN);
189189
retTable = topicMetricESDAO.listTopicMetricsByTopN(clusterId, defaultTopics, metrics, aggType, topN, startTime, endTime );
190190
}else {
191191
retTable = topicMetricESDAO.listTopicMetricsByTopics(clusterId, metrics, aggType, topics, startTime, endTime);

km-rest/src/main/java/com/xiaojukeji/know/streaming/km/rest/api/v3/cluster/ClusterConnectsController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public PaginationResult<ClusterConnectorOverviewVO> getClusterConnectorsOverview
119119
@PostMapping(value = "clusters/{clusterPhyId}/connectors-metrics")
120120
@ResponseBody
121121
public Result<List<MetricMultiLinesVO>> getClusterPhyMetrics(@PathVariable Long clusterPhyId,
122-
@Validated @RequestBody MetricsConnectorsDTO dto) {
122+
@Validated @RequestBody MetricsConnectorsDTO dto) {
123123
return connectorMetricService.listConnectClusterMetricsFromES(clusterPhyId, dto);
124124
}
125125

0 commit comments

Comments
 (0)