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

    https://github.com/apache/storm/pull/1199#discussion_r55764703
  
    --- Diff: storm-core/src/jvm/org/apache/storm/trident/TridentTopology.java 
---
    @@ -431,6 +459,52 @@ public StormTopology build() {
             
             return builder.buildTopology();
         }
    +
    +    private static Map<String, Number> mergeDefaultResources(Map<String, 
Number> res, Map defaultConfig) {
    +        Map<String, Number> ret = new HashMap<String, Number>();
    +
    +        Number  onHeapDefault = 
(Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB);
    +        Number offHeapDefault = 
(Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB);
    +        Number cpuLoadDefault = 
(Number)defaultConfig.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT);
    +
    +        if(res == null) {
    +            ret.put(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB, 
onHeapDefault);
    +            ret.put(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB, 
offHeapDefault);
    +            ret.put(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT, 
cpuLoadDefault);
    +            return ret;
    +        }
    +
    +        Number  onHeap = 
res.get(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB);
    +        Number offHeap = 
res.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB);
    +        Number cpuLoad = 
res.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT);
    +
    +        if(onHeap == null) {
    +            onHeap = onHeapDefault;
    +        }
    +        else {
    +            onHeap = Math.max(onHeap.doubleValue(), 
onHeapDefault.doubleValue());
    +        }
    +
    +        if(offHeap == null) {
    +            offHeap = offHeapDefault;
    +        }
    +        else {
    +            offHeap = Math.max(offHeap.doubleValue(), 
offHeapDefault.doubleValue());
    +        }
    +
    +        if(cpuLoad == null) {
    +            cpuLoad = cpuLoadDefault;
    +        }
    +        else {
    +            cpuLoad = Math.max(cpuLoad.doubleValue(), 
cpuLoadDefault.doubleValue());
    --- End diff --
    
    same question here


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

Reply via email to