public synchronized RecommendationResponse recommend(StackAdvisorRequest request)
      throws StackAdvisorException, AmbariException {
      requestId = generateRequestId();

    // TODO, need to pass the service Name that was modified.
    // For now, hardcode
    String serviceName = "ZOOKEEPER";

    ServiceInfo.ServiceAdvisorType serviceAdvisorType = getServiceAdvisorType(request.getStackName(), request.getStackVersion(), serviceName);
    StackAdvisorCommand<RecommendationResponse> command = createRecommendationCommand(serviceName, request);

    StackAdvisorRequestType requestType = request.getRequestType();
    RecommendationResponse response = null;
    if (requestType == StackAdvisorRequestType.CONFIGURATIONS) {
      String hash = getHash(request);
      LOG.info(String.format("Calling stack advisor with hash: %s, service: %s", hash, request.getServiceName()));
      response = configsRecommendationResponse.computeIfAbsent(hash, h -> {
        try {
          LOG.info(String.format("Invoking configuration stack advisor command with hash: %s, service: %s", hash, request.getServiceName()));
          return command.invoke(request, serviceAdvisorType);
        } catch (StackAdvisorException e) {
          return null;
        }
      });
    }

    return response == null ? command.invoke(request, serviceAdvisorType) : response;
  }
Returns recommendation (component-layout or configurations) based on the
request.

@param request the recommendation request
@return {@link RecommendationResponse} instance
@throws StackAdvisorException in case of stack advisor script errors
ambari-server/src/main/java/org/apache/ambari/server/api/services/stackadvisor/StackAdvisorHelper.java