public static Map<String, Double> parseResources(String input) { Map<String, Double> topology_resources = new HashMap<String, Double>(); JSONParser parser = new JSONParser(); LOG.debug("Input to parseResources {}", input); try { if (input != null) { Object obj = parser.parse(input); JSONObject jsonObject = (JSONObject) obj; if (jsonObject.containsKey(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB)) { Double topoMemOnHeap = org.apache.storm.utils.Utils .getDouble(jsonObject.get(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB), null); topology_resources.put(Config.TOPOLOGY_COMPONENT_RESOURCES_ONHEAP_MEMORY_MB, topoMemOnHeap); } if (jsonObject.containsKey(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB)) { Double topoMemOffHeap = org.apache.storm.utils.Utils .getDouble(jsonObject.get(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB), null); topology_resources.put(Config.TOPOLOGY_COMPONENT_RESOURCES_OFFHEAP_MEMORY_MB, topoMemOffHeap); } if (jsonObject.containsKey(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT)) { Double topoCPU = org.apache.storm.utils.Utils.getDouble(jsonObject.get(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT), null); topology_resources.put(Config.TOPOLOGY_COMPONENT_CPU_PCORE_PERCENT, topoCPU); } LOG.debug("Topology Resources {}", topology_resources); } } catch (ParseException e) { LOG.error("Failed to parse component resources is:" + e.toString(), e); return null; } return topology_resources; }