Github user revans2 commented on a diff in the pull request:
https://github.com/apache/storm/pull/2385#discussion_r149159593
--- Diff:
storm-client/src/jvm/org/apache/storm/topology/TopologyBuilder.java ---
@@ -576,10 +577,30 @@ public T addConfigurations(Map<String, Object> conf) {
throw new IllegalArgumentException("Cannot set
serializations for a component using fluent API");
}
String currConf = _commons.get(_id).get_json_conf();
-
_commons.get(_id).set_json_conf(mergeIntoJson(Utils.parseJson(currConf), conf));
+
_commons.get(_id).set_json_conf(mergeIntoJson(parseJson(currConf), conf));
return (T) this;
}
-
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public T addResource(String resourceName, Number resourceValue) {
+ Map<String, Double> resourcesMap = (Map<String, Double>)
getRASConfiguration().get(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP);
+
+ if (resourcesMap == null) {
+ resourcesMap = new HashMap<>();
+ }
+ resourcesMap.put(resourceName, resourceValue.doubleValue());
+
+
getRASConfiguration().put(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP,
resourcesMap);
--- End diff --
Like with the others this is not going to work. the map you are changing
is never put back into the serialized json config.
---