public Set<HostRequest> removeHostRequestByHostName(String hostName) {
    Set<HostRequest> removed = new HashSet<>();
    synchronized (requestsWithReservedHosts) {
      synchronized (outstandingHostRequests) {
        requestsWithReservedHosts.remove(hostName);

        Iterator<HostRequest> hostRequestIterator = outstandingHostRequests.iterator();
        while (hostRequestIterator.hasNext()) {
          HostRequest hostRequest = hostRequestIterator.next();
          if (Objects.equals(hostRequest.getHostName(), hostName)) {
            hostRequestIterator.remove();
            removed.add(hostRequest);
            break;
          }
        }

        //todo: synchronization
        Iterator<HostRequest> allHostRequestIterator = allHostRequests.iterator();
        while (allHostRequestIterator.hasNext()) {
          HostRequest hostRequest = allHostRequestIterator.next();
          if (Objects.equals(hostRequest.getHostName(), hostName)) {
            allHostRequestIterator.remove();
            removed.add(hostRequest);
            break;
          }
        }
      }
    }

    return removed;
  }
Removes all HostRequest associated with the passed host name from internal collections
@param hostName name of the host
ambari-server/src/main/java/org/apache/ambari/server/topology/LogicalRequest.java