private void deleteService(Service service, DeleteHostComponentStatusMetaData deleteMetaData) {
    final String serviceName = service.getName();

    service.delete(deleteMetaData);
    if (deleteMetaData.getAmbariException() != null) {
      return;
    }

    serviceComponentHosts.remove(serviceName);

    for (List<ServiceComponentHost> serviceComponents: serviceComponentHostsByHost.values()){
      Iterables.removeIf(serviceComponents, new Predicate<ServiceComponentHost>() {
        @Override
        public boolean apply(ServiceComponentHost serviceComponentHost) {
          return serviceComponentHost.getServiceName().equals(serviceName);
        }
      });
    }
  }
Deletes the specified service also removes references to it from {@link this.serviceComponentHosts}
and references to ServiceComponentHost objects that belong to the service from {@link this.serviceComponentHostsByHost}
<p>
  Note: This method must be called only with write lock acquired.
</p>
@param service the service to be deleted
@throws AmbariException
@see   ServiceComponentHost
ambari-server/src/main/java/org/apache/ambari/server/state/cluster/ClusterImpl.java