private void scheduleRunnable(AlertDefinitionEntity entity)
      throws ClassNotFoundException,
      IllegalAccessException, InstantiationException {

    // if the definition is disabled, do nothing
    if (!entity.getEnabled()) {
      return;
    }

    AlertDefinition definition = m_alertDefinitionFactory.coerce(entity);
    ServerSource serverSource = (ServerSource) definition.getSource();
    String sourceClass = serverSource.getSourceClass();
    int interval = definition.getInterval();

    try {
      Class<?> clazz = Class.forName(sourceClass);
      if (!AlertRunnable.class.isAssignableFrom(clazz)) {
        LOG.warn(
            "Unable to schedule a server side alert for {} because it is not an {}", sourceClass,
            AlertRunnable.class);

        return;
      }

      // instantiate and inject
      Constructor<? extends AlertRunnable> constructor = clazz.asSubclass(
          AlertRunnable.class).getConstructor(String.class);

      AlertRunnable alertRunnable = constructor.newInstance(entity.getDefinitionName());
      m_injector.injectMembers(alertRunnable);

      // schedule the runnable alert
      ScheduledFuture<?> scheduledFuture = m_scheduledExecutorService.scheduleWithFixedDelay(
          alertRunnable, interval, interval, TimeUnit.MINUTES);

      String definitionName = entity.getDefinitionName();
      ScheduledAlert scheduledAlert = new ScheduledAlert(scheduledFuture, interval);
      m_futureMap.put(definitionName, scheduledAlert);

      LOG.info("Scheduled server alert {} to run every {} minutes",
          definitionName, interval);

    } catch (ClassNotFoundException cnfe) {
      LOG.error(
          "Unable to schedule a server side alert for {} because it could not be found in the classpath",
          sourceClass);
    } catch (NoSuchMethodException nsme) {
      LOG.error(
          "Unable to schedule a server side alert for {} because it does not have a constructor which takes the proper arguments.",
          sourceClass);
    } catch (InvocationTargetException ite) {
      LOG.error(
          "Unable to schedule a server side alert for {} because an exception occurred while constructing the instance.",
          sourceClass, ite);
    }
  }
Schedules the {@link Runnable} referenced by the
{@link AlertDefinitionEntity} to run at a fixed interval.

@param entity
         the entity to schedule the runnable for (not {@code null}).
@throws ClassNotFoundException
@throws IllegalAccessException
@throws InstantiationException
ambari-server/src/main/java/org/apache/ambari/server/state/services/AmbariServerAlertService.java