panhongan commented on code in PR #11296:
URL: https://github.com/apache/druid/pull/11296#discussion_r975467790


##########
indexing-service/src/main/java/org/apache/druid/indexing/seekablestream/SeekableStreamIndexTaskClient.java:
##########
@@ -376,10 +385,47 @@ public ListenableFuture<DateTime> getStartTimeAsync(final 
String id)
     return doAsync(() -> getStartTime(id));
   }
 
-
   public ListenableFuture<Map<PartitionIdType, SequenceOffsetType>> 
pauseAsync(final String id)
   {
-    return doAsync(() -> pause(id));
+    ListenableFuture<Map<PartitionIdType, SequenceOffsetType>> future = 
doAsync(() -> pause(id));
+    pausingTaskFutureMap.put(id, new TaskPauseControlInfo(future, true));
+    return future;
+  }
+
+  public void cancelTaskPauseRequests()
+  {
+    for (Map.Entry<String, TaskPauseControlInfo> entry : 
pausingTaskFutureMap.entrySet()) {
+      String taskId = entry.getKey();
+      TaskPauseControlInfo taskPauseControl = entry.getValue();
+
+      if (!taskPauseControl.getFuture().isDone()) {
+        this.stopPausingTask(taskId, taskPauseControl);
+        log.info("Cancel unfinished pause task [%s]", taskId);
+      } else {
+        log.info("Finished pause task [%s]", taskId);
+      }
+    }

Review Comment:
   in the `pause()` method, if we want to use `while 
(pausingTaskFutureMap.containsKey(id))`,
   we should remove task id to trigger the while condition become false.



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