epugh commented on code in PR #4171:
URL: https://github.com/apache/solr/pull/4171#discussion_r2900082778
##########
solr/core/src/java/org/apache/solr/handler/admin/api/NodeHealthAPI.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);
Review Comment:
I was thinking that I wanted to
Minimize the churn in existing code, so my thought was to actually leave the
v1 code alone as much as possible and reduce the risk of breaking the business
logic in the v1 handlers. Then when we retire v1 we move the logic into the
v2 versus delegate to v1. If you think we just deal with it now, I just think
it may lead to more code to review!!!
--
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]