clintropolis commented on code in PR #20074:
URL: https://github.com/apache/druid/pull/20074#discussion_r3816530919


##########
processing/src/main/java/org/apache/druid/common/asyncresource/SettableAsyncResource.java:
##########
@@ -263,9 +268,11 @@ public void close()
         default -> throw DruidException.defensive("Already closed");
       };
 
-      // Clear result and canceler to allow GC.
+      // Clear result and canceler to allow GC. Dropping the pending ready 
callbacks ensures they are not fired if
+      // close() was called before set/setException.
       result = null;
       canceler = null;
+      readyCallbacks.clear();

Review Comment:
   I think this is ok, the consumer is expected to call close to abandon an 
acquire, while the producer should only ever call set/setException, meaning 
that this should only be a problem in cases where there are multiple consumer 
threads I think? Nothing is using await in production currently, but added some 
javadoc to try to clear up the usage model.



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