code: public static ResourceRequest getUnitResourceRequest(ResourceType type) {
      ResourceRequest req = unitResourceRequestMap.get(type);
      if (req == null) {
        req = new ResourceRequest(1, type);
        req.setSpecs(UNIT_COMPUTE_SPECS);
  
        // instead of using concurrent classes or locking - we clone and replace
        // the map with a new entry. this makes sense because this structure is
        // entirely read-only and will be populated quickly at bootstrap time
  
        HashMap<ResourceType, ResourceRequest> newMap =
            new HashMap<ResourceType, ResourceRequest>();
        for (Map.Entry<ResourceType, ResourceRequest> entry :
            unitResourceRequestMap.entrySet()) {
          newMap.put(entry.getKey(), entry.getValue());
        }
        newMap.put(type, req);
        unitResourceRequestMap = newMap;
      }
      return req;
    }
docs: Get a {@link ResourceRequest} object for a given resource type
  Will cache the resource request after the first time it is created
  
  @param type the type to return the {@link ResourceRequest} for
  @return the {@link ResourceRequest} object for a given type