dsmiley commented on code in PR #1182:
URL: https://github.com/apache/solr/pull/1182#discussion_r1035468060


##########
solr/core/src/java/org/apache/solr/util/SolrCLI.java:
##########
@@ -618,6 +623,10 @@ private static boolean exceptionIsAuthRelated(Exception 
exc) {
         && Arrays.asList(UNAUTHORIZED.code, 
FORBIDDEN.code).contains(((SolrException) exc).code()));
   }
 
+  public static SolrClient getHttpSolrClient(String baseUrl) {
+    return new 
Http2SolrClient.Builder(baseUrl).maxConnectionsPerHost(32).build();

Review Comment:
   why set this to 32?



##########
solr/core/src/java/org/apache/solr/util/SolrCLI.java:
##########
@@ -968,38 +978,39 @@ public Map<String, Object> getStatus(String solrUrl) 
throws Exception {
 
       if (!solrUrl.endsWith("/")) solrUrl += "/";
 
-      String systemInfoUrl = solrUrl + "admin/info/system";
-      CloseableHttpClient httpClient = getHttpClient();
-      try {
-        // hit Solr to get system info
-        Map<String, Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, 
true);
+      try (var solrClient = getHttpSolrClient(solrUrl)) {
+        NamedList<Object> systemInfo =
+            solrClient.request(
+                new GenericSolrRequest(
+                    SolrRequest.METHOD.GET,
+                    CommonParams.SYSTEM_INFO_PATH,
+                    new ModifiableSolrParams()));
         // convert raw JSON into user-friendly output
-        status = reportStatus(solrUrl, systemInfo, httpClient);
-      } finally {
-        closeHttpClient(httpClient);
+        status = reportStatus(systemInfo, solrClient);
       }
 
       return status;
     }
 
-    public Map<String, Object> reportStatus(
-        String solrUrl, Map<String, Object> info, HttpClient httpClient) 
throws Exception {
+    public Map<String, Object> reportStatus(NamedList<Object> info, SolrClient 
solrClient)
+        throws Exception {
       Map<String, Object> status = new LinkedHashMap<>();
 
       String solrHome = (String) info.get("solr_home");
       status.put("solr_home", solrHome != null ? solrHome : "?");
-      status.put("version", asString("/lucene/solr-impl-version", info));
-      status.put("startTime", asString("/jvm/jmx/startTime", info));
-      status.put("uptime", uptime(asLong("/jvm/jmx/upTimeMS", info)));
+      status.put("version", ((NamedList) 
info.get("lucene")).get("solr-impl-version"));
 
-      String usedMemory = asString("/jvm/memory/used", info);
-      String totalMemory = asString("/jvm/memory/total", info);
+      @SuppressWarnings("unchecked")
+      NamedList<Object> jvm = (NamedList<Object>) info.get("jvm");
+      status.put("startTime", ((NamedList) jvm.get("jmx")).get("startTime"));
+      status.put("uptime", uptime((Long) ((NamedList) 
jvm.get("jmx")).get("upTimeMS")));

Review Comment:
   I don't see why this method was modified regarding extraction from "info".



##########
solr/core/src/java/org/apache/solr/util/SolrCLI.java:
##########
@@ -968,38 +978,39 @@ public Map<String, Object> getStatus(String solrUrl) 
throws Exception {
 
       if (!solrUrl.endsWith("/")) solrUrl += "/";
 
-      String systemInfoUrl = solrUrl + "admin/info/system";
-      CloseableHttpClient httpClient = getHttpClient();
-      try {
-        // hit Solr to get system info
-        Map<String, Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, 
true);
+      try (var solrClient = getHttpSolrClient(solrUrl)) {
+        NamedList<Object> systemInfo =
+            solrClient.request(
+                new GenericSolrRequest(
+                    SolrRequest.METHOD.GET,
+                    CommonParams.SYSTEM_INFO_PATH,
+                    new ModifiableSolrParams()));

Review Comment:
   Very glad to see we are simply using SolrJ rather than lower level HTTP 
requests



##########
solr/core/src/java/org/apache/solr/util/SolrCLI.java:
##########
@@ -968,38 +978,39 @@ public Map<String, Object> getStatus(String solrUrl) 
throws Exception {
 
       if (!solrUrl.endsWith("/")) solrUrl += "/";
 
-      String systemInfoUrl = solrUrl + "admin/info/system";
-      CloseableHttpClient httpClient = getHttpClient();
-      try {
-        // hit Solr to get system info
-        Map<String, Object> systemInfo = getJson(httpClient, systemInfoUrl, 2, 
true);
+      try (var solrClient = getHttpSolrClient(solrUrl)) {
+        NamedList<Object> systemInfo =
+            solrClient.request(
+                new GenericSolrRequest(
+                    SolrRequest.METHOD.GET,
+                    CommonParams.SYSTEM_INFO_PATH,
+                    new ModifiableSolrParams()));
         // convert raw JSON into user-friendly output
-        status = reportStatus(solrUrl, systemInfo, httpClient);
-      } finally {
-        closeHttpClient(httpClient);
+        status = reportStatus(systemInfo, solrClient);
       }
 
       return status;
     }
 
-    public Map<String, Object> reportStatus(
-        String solrUrl, Map<String, Object> info, HttpClient httpClient) 
throws Exception {
+    public Map<String, Object> reportStatus(NamedList<Object> info, SolrClient 
solrClient)
+        throws Exception {
       Map<String, Object> status = new LinkedHashMap<>();
 
       String solrHome = (String) info.get("solr_home");
       status.put("solr_home", solrHome != null ? solrHome : "?");
-      status.put("version", asString("/lucene/solr-impl-version", info));
-      status.put("startTime", asString("/jvm/jmx/startTime", info));
-      status.put("uptime", uptime(asLong("/jvm/jmx/upTimeMS", info)));
+      status.put("version", ((NamedList) 
info.get("lucene")).get("solr-impl-version"));
 
-      String usedMemory = asString("/jvm/memory/used", info);
-      String totalMemory = asString("/jvm/memory/total", info);
+      @SuppressWarnings("unchecked")
+      NamedList<Object> jvm = (NamedList<Object>) info.get("jvm");
+      status.put("startTime", ((NamedList) jvm.get("jmx")).get("startTime"));
+      status.put("uptime", uptime((Long) ((NamedList) 
jvm.get("jmx")).get("upTimeMS")));
+      String usedMemory = (String) ((NamedList) jvm.get("memory")).get("used");
+      String totalMemory = (String) ((NamedList) 
jvm.get("memory")).get("total");
       status.put("memory", usedMemory + " of " + totalMemory);
 
-      // if this is a Solr in solrcloud mode, gather some basic cluster info

Review Comment:
   I guess you deleted because, why state the obvious?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to