@Subscribe
  @AllowConcurrentEvents
  public void onAmbariEvent(ServiceRemovedEvent event) {
    LOG.debug("Received event {}", event);

    try {
      m_clusters.get().getClusterById(event.getClusterId());
    } catch (AmbariException e) {
      LOG.warn("Unable to retrieve cluster with id {}", event.getClusterId());
      return;
    }

    String serviceName = event.getServiceName();
    Lock lock = m_locksByService.get(serviceName);
    lock.lock();

    try {
      List<AlertDefinitionEntity> definitions = m_definitionDao.findByService(event.getClusterId(),
          event.getServiceName());

      for (AlertDefinitionEntity definition : definitions) {
        try {
          m_definitionDao.remove(definition);
        } catch (Exception exception) {
          LOG.error("Unable to remove alert definition {}", definition.getDefinitionName(),
              exception);
        }
      }

      // remove the default group for the service
      AlertGroupEntity group = m_alertDispatchDao.findGroupByName(event.getClusterId(),
          event.getServiceName());

      if (null != group && group.isDefault()) {
        try {
          m_alertDispatchDao.remove(group);
        } catch (Exception exception) {
          LOG.error("Unable to remove default alert group {}", group.getGroupName(), exception);
        }
      }
    } finally {
      lock.unlock();
    }
  }
Removes all alert data associated with the removed serviced.

@param event
         the published event being handled (not {@code null}).
ambari-server/src/main/java/org/apache/ambari/server/events/listeners/alerts/AlertServiceStateListener.java