Github user aledsage commented on a diff in the pull request:
https://github.com/apache/incubator-brooklyn/pull/595#discussion_r28328337
--- 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 --
Not convinced we should just synchronize on this map, without knowing
anything about it. That feels dangerous and ad hoc. We can presumably rely on
the map's put method to be synchronized if the map really needs to be
synchronized. What do we expect this map (returned by `target.get(this)`) to be?
---
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.
---