Class ResourcePool<K,V>

java.lang.Object
org.apache.druid.java.util.http.client.pool.ResourcePool<K,V>
All Implemented Interfaces:
Closeable, AutoCloseable

public class ResourcePool<K,V> extends Object implements Closeable
A resource pool based on LoadingCache. When a resource is first requested for a new key, If the flag: eagerInitialization is true: use ResourcePool.EagerCreationResourceHolder ResourcePoolConfig.getMaxPerKey() resources are initialized and cached in the pool. Else: Initialize a single resource and further lazily using ResourcePool.LazyCreationResourceHolder The individual resource in ResourcePool.ResourceHolderPerKey is valid while (current time - last access time) invalid input: '<'= ResourcePoolConfig.getUnusedConnectionTimeoutMillis(). A resource is closed and reinitialized if ResourceFactory.isGood(V) returns false or it's expired based on ResourcePoolConfig.getUnusedConnectionTimeoutMillis(). invalid input: 'is a hard limit for the max number of resources per cache entry. The total number of resources in {@link ResourceHolderPerKey} cannot be larger than the limit in any case.'