File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
src/main/java/org/apache/commons/pool3/impl Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -210,8 +210,13 @@ public String toString() {
210210 * My hash of sub-pools (ObjectQueue). The list of keys <strong>must</strong> be kept
211211 * in step with {@link #poolKeyList} using {@link #keyLock} to ensure any
212212 * changes to the list of current keys is made in a thread-safe manner.
213+ *
214+ * Correct operation of the pool requires that a Map implementation is used that
215+ * supports concurrent read and write (e.g. ensureMinIdle() iterates over the key set
216+ * while other threads may be adding or removing keys) therefore explicitly define
217+ * this field as ConcurrentHashMap rather than Map.
213218 */
214- private final Map <K , ObjectDeque <T >> poolMap =
219+ private final ConcurrentHashMap <K , ObjectDeque <T >> poolMap =
215220 new ConcurrentHashMap <>(); // @GuardedBy("keyLock") for write access (and some read access)
216221
217222 /*
You can’t perform that action at this time.
0 commit comments