code: private void removePendingRequest(ResourceRequestInfo req) {
      ResourceRequestInfo removed = idToPendingRequests.remove(req.getId());
      if (removed != null) {
        if (req.getHosts() != null && req.getHosts().size() > 0) {
          Context c = getContext(req.getType());
          for (RequestedNode node : req.getRequestedNodes()) {
            String host = node.getHost();
            List<ResourceRequestInfo> hostReqs =
              c.hostToPendingRequests.get(host);
            Utilities.removeReference(hostReqs, req);
            if (hostReqs.isEmpty()) {
              c.hostToPendingRequests.remove(host);
            }
            Node rack = node.getRack();
            List<ResourceRequestInfo> rackReqs =
              c.rackToPendingRequests.get(rack);
            Utilities.removeReference(rackReqs, req);
            if (rackReqs.isEmpty()) {
              c.rackToPendingRequests.remove(rack);
            }
          }
        }
        Context c = getContext(req.getType());
        Utilities.removeReference(c.anyHostRequests, req);
      }
  
      removePendingRequestForType(req);
    }
docs: Removes the request from the list of pending
  @param req the request to remove