AmatyaAvadhanula commented on a change in pull request #12298:
URL: https://github.com/apache/druid/pull/12298#discussion_r820399439



##########
File path: 
core/src/main/java/org/apache/druid/java/util/http/client/pool/ResourcePool.java
##########
@@ -154,30 +167,19 @@ public void close()
     }
   }
 
-  private static class ImmediateCreationResourceHolder<K, V> implements 
Closeable
+  private static class EagerCreationResourceHolder<K, V> extends 
ResourceHolderPerKey<K, V>
   {
-    private final int maxSize;
-    private final K key;
-    private final ResourceFactory<K, V> factory;
-    private final ArrayDeque<ResourceHolder<V>> resourceHolderList;
-    private int deficit = 0;
-    private boolean closed = false;
-    private final long unusedResourceTimeoutMillis;
-
-    private ImmediateCreationResourceHolder(
+    private EagerCreationResourceHolder(
         int maxSize,
         long unusedResourceTimeoutMillis,
         K key,
         ResourceFactory<K, V> factory
     )
     {
-      this.maxSize = maxSize;
-      this.key = key;
-      this.factory = factory;
-      this.unusedResourceTimeoutMillis = unusedResourceTimeoutMillis;
-      this.resourceHolderList = new ArrayDeque<>();
-
-      for (int i = 0; i < maxSize; ++i) {
+      super(maxSize, unusedResourceTimeoutMillis, key, factory);
+      eagerInstantiation = true;

Review comment:
       I'm not sure if the way eagerInstantiation is being used within 
ResourceHolderPerKey is considered a good practice.
   The reason it's not being used as a field in the constructor is to avoid 
potential misuse (such as eagerInstantiation = false) in the eager super class




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