YongGang commented on code in PR #14880:
URL: https://github.com/apache/druid/pull/14880#discussion_r1331989856


##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractTask.java:
##########
@@ -178,14 +183,25 @@ public final TaskStatus run(TaskToolbox taskToolbox) 
throws Exception
       throw e;
     }
     finally {
-      cleanUp(taskToolbox, taskStatus);
+      try {
+        cleanUp(taskToolbox, taskStatus);
+      }
+      finally {
+        cleanupCompletionLatch.countDown();
+      }
     }
   }
 
   public abstract TaskStatus runTask(TaskToolbox taskToolbox) throws Exception;
 
+  @Override
   public void cleanUp(TaskToolbox toolbox, TaskStatus taskStatus) throws 
Exception
   {
+    if (Thread.currentThread().isInterrupted()) {

Review Comment:
   updated.



##########
indexing-service/src/main/java/org/apache/druid/indexing/common/task/AbstractTask.java:
##########
@@ -216,6 +232,23 @@ public void cleanUp(TaskToolbox toolbox, TaskStatus 
taskStatus) throws Exception
     }
   }
 
+  @Override
+  public boolean waitForCleanupToFinish()
+  {
+    try {
+      if (cleanupCompletionLatch != null) {
+        // block until the cleanup process completes
+        return cleanupCompletionLatch.await(30, TimeUnit.SECONDS);

Review Comment:
   I updated to 100 seconds, it won't take that long to finish cleanUp. warning 
message is also added.
   the time taken to shutdown is recorded in `SingleTaskBackgroundRunner#stop`



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