clintropolis commented on PR #20074:
URL: https://github.com/apache/druid/pull/20074#issuecomment-5608908556

   >Thinking about this some more, I think there's a scenario where this is 
useful. Let's say you're a consumer and you own an AsyncResource, and you've 
registered an addReadyCallback that resolves a SettableFuture that represents 
the result of a computation on that resource (such as the result of a query). 
Let's say you decide you need to cancel yourself (maybe the query was 
canceled). With firing callbacks on close, you could simply call close() on the 
AsyncResource, and that would call the callbacks you registered to fire, which 
would resolve the SettableFuture somehow, meaning you wouldn't need to do that 
in addition to closing the resource. Seems useful.
   
   Yea, that seems a reasonable way to use this, allowing the consumer to just 
set their callbacks up to gracefully handle the 
`AsyncResourceCanceledException` and not having to explicitly cancel their 
waiting. Should I mention this usage pattern in the javadocs?


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