@Override
  public void delete(DeleteHostComponentStatusMetaData deleteMetaData) {
    boolean fireRemovalEvent = false;

    writeLock.lock();
    String version = getVersion();
    try {
      removeEntities();
      fireRemovalEvent = true;
      clusters.getCluster(getClusterName()).removeServiceComponentHost(this);
    } catch (AmbariException ex) {
      LOG.error("Unable to remove a service component from a host", ex);
    } finally {
      writeLock.unlock();
    }

    // publish event for the removal of the SCH after the removal is
    // completed, but only if it was persisted
    if (fireRemovalEvent) {
      long clusterId = getClusterId();
      StackId stackId = serviceComponent.getDesiredStackId();
      String stackVersion = stackId.getStackVersion();
      String stackName = stackId.getStackName();
      String serviceName = getServiceName();
      String componentName = getServiceComponentName();
      String hostName = getHostName();
      State lastComponentState = getState();
      boolean recoveryEnabled = isRecoveryEnabled();
      boolean masterComponent = serviceComponent.isMasterComponent();

      ServiceComponentUninstalledEvent event = new ServiceComponentUninstalledEvent(
          clusterId, stackName, stackVersion, serviceName, componentName,
          hostName, recoveryEnabled, masterComponent, host.getHostId());

      eventPublisher.publish(event);
      deleteMetaData.addDeletedHostComponent(componentName,
          serviceName,
          hostName,
          getHost().getHostId(),
          Long.toString(clusterId),
          version,
          lastComponentState);
    }
  }
@param lastOpLastUpdateTime the lastOpLastUpdateTime to set
ambari-server/src/main/java/org/apache/ambari/server/state/svccomphost/ServiceComponentHostImpl.java