} });
}); } else { doRestart(name); }
  private void restartAgent(final String name) {    if (restartsEnabled) {      long pingTimeout = getLongAttribute(preferredLeader(),                                          DEFAULT_TIMEOUT_ATTRIBUTE,                                          DEFAULT_TIMEOUT) * MS_PER_MIN;      serviceChecker.checkServices(model.getCommunityName(),                                   ESSENTIAL_RESTART_SERVICE_ATTRIBUTE,                                   pingTimeout,                                   new CheckServicesListener() {        public void execute(String communityName,                            String serviceCategory,                            boolean isAvailable,                            String message) {          if (isAvailable) {            doRestart(name);          } else {            if (logger.isWarnEnabled()) {              logger.warn("Unable to restart " + name +                          ", " + message);            }            newState(name, FAILED_RESTART);          }        }      });    }  }