gianm commented on code in PR #12626:
URL: https://github.com/apache/druid/pull/12626#discussion_r894976487


##########
core/src/main/java/org/apache/druid/java/util/http/client/pool/ResourcePool.java:
##########
@@ -119,11 +119,17 @@ public V get()
         return value;
       }
 
+      @Override
+      public boolean isPresent()
+      {
+        return !returned.get();
+      }
+
       @Override
       public void returnResource()
       {
         if (returned.getAndSet(true)) {
-          log.warn(StringUtils.format("Resource at key[%s] was returned 
multiple times?", key));
+          log.warn("Resource at key[%s] was returned multiple times?", key);

Review Comment:
   I was thinking the log message is useful in situations where the caller 
thinks they are returning a resource for the only time. Most calls to 
returnResource are still not guarded by isPresent, for this reason.
   
   However for exceptionCaught specifically, it may be called multiple times on 
the same response. So we need some way to account for that. I thought about 
removing the log message completely, but then chose to keep it and use 
isPresent, since I figured it was still useful in those other cases.



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