code: private void loadLocalityWaits(JSONObject json, Map<ResourceType, Long> 
                 newTypeToNodeWait, Map<ResourceType, Long> newTypeToRackWait) 
                 throws JSONException {
      Iterator<String> keys = json.keys();
      while (keys.hasNext()) {
        String key = keys.next();
        if (!json.isNull(key)) {
          for (ResourceType type : TYPES) {
            if (key.equals("nodeLocalityWait" + type)) {
              long val = Long.parseLong(json.getString(key));
              newTypeToNodeWait.put(type, val);
            }
            if (key.equals("rackLocalityWait" + type)) {
              long val = Long.parseLong(json.getString(key));
              newTypeToRackWait.put(type, val);
            }
          }
        }
      }
    }
docs: Helper function to reloadJsonConfig(). Parses the JSON Object
  corresponding to the key "TYPES".
  @throws JSONException