flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yuqi1129 <...@git.apache.org>
Subject [GitHub] flink pull request #5959: [FLINK-9258][metrics] Thread-safe initialization o...
Date Tue, 08 May 2018 02:39:46 GMT
Github user yuqi1129 commented on a diff in the pull request:

    https://github.com/apache/flink/pull/5959#discussion_r186603684
  
    --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/ComponentMetricGroup.java
---
    @@ -57,11 +57,12 @@ public ComponentMetricGroup(MetricRegistry registry, String[] scope,
P parent) {
     		if (variables == null) { // avoid synchronization for common case
     			synchronized (this) {
     				if (variables == null) {
    -					variables = new HashMap<>();
    -					putVariables(variables);
    +					Map<String, String> tmpVariables = new HashMap<>();
    +					putVariables(tmpVariables);
     					if (parent != null) { // not true for Job-/TaskManagerMetricGroup
    -						variables.putAll(parent.getAllVariables());
    +						tmpVariables.putAll(parent.getAllVariables());
     					}
    +					variables = tmpVariables;
    --- End diff --
    
    Do not need any test that verify this change ?


---

Mime
View raw message