Procházet zdrojové kódy

feat: Fix typo in FlowRuleManager and improve code with Map.computeIfAbsent in MetricTimerListener (#2110)

master
drgnchan GitHub před 3 roky
rodič
revize
2f90a87cab
V databázi nebyl nalezen žádný známý klíč pro tento podpis ID GPG klíče: 4AEE18F83AFDEB23
2 změnil soubory, kde provedl 2 přidání a 4 odebrání
  1. +1
    -3
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/metric/MetricTimerListener.java
  2. +1
    -1
      sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleManager.java

+ 1
- 3
sentinel-core/src/main/java/com/alibaba/csp/sentinel/node/metric/MetricTimerListener.java Zobrazit soubor

@@ -62,9 +62,7 @@ public class MetricTimerListener implements Runnable {
MetricNode metricNode = entry.getValue();
metricNode.setResource(node.getName());
metricNode.setClassification(node.getResourceType());
if (maps.get(time) == null) {
maps.put(time, new ArrayList<MetricNode>());
}
maps.computeIfAbsent(time, k -> new ArrayList<MetricNode>());
List<MetricNode> nodes = maps.get(time);
nodes.add(entry.getValue());
}


+ 1
- 1
sentinel-core/src/main/java/com/alibaba/csp/sentinel/slots/block/flow/FlowRuleManager.java Zobrazit soubor

@@ -77,7 +77,7 @@ public class FlowRuleManager {
private static void startMetricTimerListener() {
long flushInterval = SentinelConfig.metricLogFlushIntervalSec();
if (flushInterval <= 0) {
RecordLog.info("[FlowRuleManager] The MetricTimerListener is'n started. If you want to start it, "
RecordLog.info("[FlowRuleManager] The MetricTimerListener isn't started. If you want to start it, "
+ "please change the value(current: {}) of config({}) more than 0 to start it.", flushInterval,
SentinelConfig.METRIC_FLUSH_INTERVAL);
return;


Načítá se…
Zrušit
Uložit