yashmayya commented on PR #12478:
URL: https://github.com/apache/kafka/pull/12478#issuecomment-1224289212

   >Why construct the latches in Worker? Wouldn't it be cleaner to create them 
in the RetryWithToleranceOperator constructor and expose a method in that class 
to count down the latch, which we could then invoke from tasks inside their 
cancel method?
   
   That's a fair point, I guess I was coming from the point of view of 
implementing a generic solution which could potentially be re-used by other 
operations that require signalling when a task is cancelled (i.e by awaiting on 
the task's cancel latch). But I think since this `RetryWithToleranceOperator` 
seems to be the only one where such a thing would be useful right now, I agree 
that your proposed solution is cleaner. 
   
   > As far as testing goes, can we just mock the latch and leave everything 
else basically as-is? We should continue to use the Time interface for 
everything except sleeping, so all the existing invocations of 
Time::milliseconds can stay.
   
   The `MockTime::sleep` method advances its internal time counter which is 
then used in the tests to make assertions on how much time has elapsed.


-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to