kfaraz commented on PR #14880:
URL: https://github.com/apache/druid/pull/14880#issuecomment-1736842252

   Sorry for the late reply.
   
   > Task can only do cleanUp when it stopped running otherwise we don't know 
the exact status of it. For task like AbstractBatchIndexTask it interrupt 
thread to make it stop running, but its timing is not deterministic. Here we 
use latch to give the task time to stop and do cleanUp work.
   
   I see your point. Currently, cleanup is called from `run` method of task 
either after it has finished running or if an exception has occurred while 
running. Whereas `stopGracefully` is called when we are trying to terminate the 
task from a different thread.
   
   Ideally the `stopGracefully` method itself should have ensured that the 
cleanup has completed, thus avoiding the need for a new 
`waitForCleanupToFinish` method. But I see that all Task implementations are 
handling the `stopGracefully` in different ways. So fixing that might be more 
change than necessary right now.


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