@Override
  public void doGet(HttpServletRequest request, HttpServletResponse response) {
    try {
      if (!HttpServer.isInstrumentationAccessAllowed(getServletContext(),
                                                     request, response)) {
        response.setStatus(HttpServletResponse.SC_FORBIDDEN);
      } else {
        String  collString   = "\"disabled\"";
        boolean statsEnabled = false;

        // populate header
        response.setContentType("application/json; charset=utf8");
        response.setHeader(ACCESS_CONTROL_ALLOW_METHODS, "GET");
        response.setHeader(ACCESS_CONTROL_ALLOW_ORIGIN, "*");
        response.setHeader("Cache-Control",
                           "no-transform,public,max-age=60,s-maxage=60");

        if (null != conf && HiveConf.getBoolVar(conf,
                            HiveConf.ConfVars.LLAP_COLLECT_LOCK_METRICS)) {
          collString = "\"enabled\"";
          statsEnabled = true;
        }

        StringBuffer result = new StringBuffer();
        List<MetricsSource> sourceList
            = ReadWriteLockMetrics.getAllMetricsSources();
        if (null == sourceList) {
          // should actually never happen
          result.append("{\"error\":\"R/W statistics not found\"}");
        } else {
          sourceList.sort(new ReadWriteLockMetrics.MetricsComparator());
          boolean first = true;

          result.append("{\"statsCollection\":");
          result.append(collString);
          result.append(",\"lockStats\":[");

          // dump an object per lock label
          if (statsEnabled) {
            for (MetricsSource ms : sourceList) {
              if (!first) {
                result.append(",");
              }

              first = false;
              result.append(ms);
            }
          }

          result.append("]}");
        }

        // send string through JSON parser/builder to pretty print it.
        JsonParser parser = new JsonParser();
        JsonObject json   = parser.parse(result.toString()).getAsJsonObject();
        Gson       gson   = new GsonBuilder().setPrettyPrinting().create();
        try (PrintWriter w = response.getWriter()) {
          w.println(gson.toJson(json));
        }
      }
    }
    catch (Exception e) {
      LOG.error("Exception while processing locking stats request", e);
      response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
    }
  }
Configuration setter, used to figure out the lock statistics collection setting.

@param c The configuration to use
llap-server/src/java/org/apache/hadoop/hive/llap/daemon/services/impl/LlapLockingServlet.java