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

    https://github.com/apache/storm/pull/2385#discussion_r149148502
  
    --- Diff: 
storm-client/src/jvm/org/apache/storm/coordination/BatchSubtopologyBuilder.java 
---
    @@ -450,9 +456,33 @@ public BoltDeclarer addConfigurations(Map<String, 
Object> conf) {
             }
     
             @Override
    +        public Map getRASConfiguration() {
    +            for (Map<String, Object> conf : _component.componentConfs) {
    +                if 
(conf.containsKey(Config.TOPOLOGY_COMPONENT_RESOURCES_MAP)) {
    +                    return conf;
    +                }
    +            }
    +            return new HashMap<>();
    +        }
    +
    +        @Override
             public BoltDeclarer addSharedMemory(SharedMemory request) {
                 _component.sharedMemory.add(request);
                 return this;
             }
    +
    +        @SuppressWarnings("unchecked")
    +        @Override
    +        public BoltDeclarer 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 --
    
    This does not work, see my comment above inside `getRASConfiguration`


---

Reply via email to