Github user StephanEwen commented on a diff in the pull request:

    https://github.com/apache/flink/pull/2300#discussion_r75112407
  
    --- Diff: 
flink-runtime/src/main/java/org/apache/flink/runtime/metrics/groups/AbstractMetricGroup.java
 ---
    @@ -83,9 +88,25 @@
     
        // 
------------------------------------------------------------------------
     
    -   public AbstractMetricGroup(MetricRegistry registry, String[] scope) {
    +   public AbstractMetricGroup(MetricRegistry registry, String[] scope, A 
parent) {
                this.registry = checkNotNull(registry);
                this.scopeComponents = checkNotNull(scope);
    +           this.parent = parent;
    +   }
    +
    +   public Map<String, String> getAllVariables() {
    +           if (variables == null) { // avoid synchronization for common 
case
    --- End diff --
    
    This "double check locking" does not work properly, unless you make the 
variable `variables` volatile.
    I am wondering if we should not simply initialize the map eagerly.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to