epugh commented on code in PR #4171:
URL: https://github.com/apache/solr/pull/4171#discussion_r2917689589


##########
solr/core/src/java/org/apache/solr/handler/admin/api/NodeHealth.java:
##########
@@ -17,32 +17,44 @@
 
 package org.apache.solr.handler.admin.api;
 
-import static org.apache.solr.client.solrj.SolrRequest.METHOD.GET;
 import static org.apache.solr.security.PermissionNameProvider.Name.HEALTH_PERM;
 
-import org.apache.solr.api.EndPoint;
+import jakarta.inject.Inject;
+import org.apache.solr.api.JerseyResource;
+import org.apache.solr.client.api.endpoint.NodeHealthApi;
+import org.apache.solr.client.api.model.NodeHealthResponse;
+import org.apache.solr.core.CoreContainer;
 import org.apache.solr.handler.admin.HealthCheckHandler;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.response.SolrQueryResponse;
+import org.apache.solr.jersey.PermissionName;
 
 /**
  * V2 API for checking the health of the receiving node.
  *
  * <p>This API (GET /v2/node/health) is analogous to the v1 /admin/info/health.
+ *
+ * <p>This is a thin JAX-RS wrapper; the health-check logic lives in {@link 
HealthCheckHandler}.
  */
-public class NodeHealthAPI {
+public class NodeHealthAPI extends JerseyResource implements NodeHealthApi {
+
   private final HealthCheckHandler handler;
 
-  public NodeHealthAPI(HealthCheckHandler handler) {
-    this.handler = handler;
+  @Inject
+  public NodeHealthAPI(CoreContainer coreContainer) {
+    this.handler = new HealthCheckHandler(coreContainer);
+  }
+
+  @Override
+  @PermissionName(HEALTH_PERM)
+  public NodeHealthResponse checkNodeHealth(Boolean requireHealthyCores) {
+    return handler.checkNodeHealth(requireHealthyCores, null);
   }
 
-  // TODO Update permission here once SOLR-11623 lands.
-  @EndPoint(
-      path = {"/node/health"},
-      method = GET,
-      permission = HEALTH_PERM)
-  public void getSystemInformation(SolrQueryRequest req, SolrQueryResponse 
rsp) throws Exception {
-    handler.handleRequestBody(req, rsp);
+  /**
+   * Convenience overload used by tests and the v1 handler to pass both 
health-check parameters.
+   *
+   * @see HealthCheckHandler#checkNodeHealth(Boolean, Integer)
+   */
+  public NodeHealthResponse checkNodeHealth(Boolean requireHealthyCores, 
Integer maxGenerationLag) {

Review Comment:
   i think I've answered both of these....   



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to