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


##########
solr/core/src/java/org/apache/solr/handler/component/TaskCancellationHandler.java:
##########
@@ -19,53 +19,44 @@
 import static org.apache.solr.common.params.CommonParams.QUERY_UUID;
 
 import java.util.Collection;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
-import org.apache.solr.api.AnnotatedApi;
 import org.apache.solr.api.Api;
-import org.apache.solr.handler.admin.api.CancelTaskAPI;
+import org.apache.solr.api.JerseyResource;
+import org.apache.solr.handler.admin.api.CancelTask;
 import org.apache.solr.request.SolrQueryRequest;
 import org.apache.solr.request.SolrRequestHandler;
 import org.apache.solr.response.SolrQueryResponse;
 import org.apache.solr.security.AuthorizationContext;
 import org.apache.solr.security.PermissionNameProvider;
 
 /** Handles requests for query cancellation for cancellable queries */
-public class QueryCancellationHandler extends TaskManagementHandler {
+public class TaskCancellationHandler extends TaskManagementHandler {
   // This can be a parent level member but we keep it here to allow future 
handlers to have
   // a custom list of components
-  private List<SearchComponent> components;
 
   @Override
   public void handleRequestBody(SolrQueryRequest req, SolrQueryResponse rsp) 
throws Exception {
-    ResponseBuilder rb = buildResponseBuilder(req, rsp, getComponentsList());
-    Map<String, String> extraParams = null;
+    String taskCancellationID = req.getParams().get(QUERY_UUID, null);
 
-    rb.setCancellation(true);
-
-    String cancellationUUID = req.getParams().get(QUERY_UUID, null);
-
-    if (cancellationUUID == null) {
+    if (taskCancellationID == null) {
       throw new IllegalArgumentException(
           "Query cancellation was requested but no query UUID for cancellation 
was given");
     }
 
-    if (rb.isDistrib) {
-      extraParams = new HashMap<>();
+    boolean isTaskCancelled = ActiveTaskQuerySupport.cancelTask(req, 
taskCancellationID);
 
-      extraParams.put(QUERY_UUID, cancellationUUID);
+    if (isTaskCancelled) {
+      rsp.add("status", "Query with queryID " + taskCancellationID + " 
cancelled successfully");
+      rsp.add("responseCode", 200);
+    } else {
+      rsp.add("status", "Query with queryID " + taskCancellationID + " not 
found");

Review Comment:
   I wonder if we are embracing the task name then maybe we should refefrent 
thsese as "Query with taskID" and drop the "queryID" concept. 



-- 
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