brooklyn-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ahgittin <...@git.apache.org>
Subject [GitHub] incubator-brooklyn pull request: Make YAML more powerful
Date Thu, 16 Apr 2015 01:21:58 GMT
Github user ahgittin commented on a diff in the pull request:

    https://github.com/apache/incubator-brooklyn/pull/595#discussion_r28478044
  
    --- Diff: core/src/main/java/brooklyn/event/basic/MapConfigKey.java ---
    @@ -125,6 +130,20 @@ protected Object applyEntryValueToMap(Entry value, Map target) {
             } else if (k instanceof String) {
                 k = subKey((String)k);
             } else {
    +            // supplier or other unexpected value
    +            if (k instanceof Supplier) {
    +                // TODO not thread-safe
    +                Object mapAtRoot = target.get(this);
    +                if (mapAtRoot==null) {
    +                    mapAtRoot = new LinkedHashMap();
    +                    target.put(this, mapAtRoot);
    +                }
    +                if (mapAtRoot instanceof Map) {
    +                    synchronized (mapAtRoot) {
    --- End diff --
    
    often the map will be what we `put` just above -- ie an LHMap, and sometimes it will come
from another source, e.g. yaml parse (also often an LHMap).
    
    in most cases synching on the map is the standard way to synchronize.  it's not foolproof
of course.  but feels likely to cause a problem than a CME on an LHMap.
    
    will add a comment to that effect.


---
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 infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message