You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2022/03/07 05:54:46 UTC
[GitHub] [druid] AmatyaAvadhanula commented on a change in pull request #12298: Facilitate lazy initialization of connections to mitigate overwhelming of Coordinator
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: commits-unsubscribe@druid.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org