You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2012/04/12 21:50:02 UTC
svn commit: r1325469 -
/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Author: markt
Date: Thu Apr 12 19:50:02 2012
New Revision: 1325469
URL: http://svn.apache.org/viewvc?rev=1325469&view=rev
Log:
Fix POOL-212 for GKOP.
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1325469&r1=1325468&r2=1325469&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java Thu Apr 12 19:50:02 2012
@@ -452,6 +452,11 @@ public class GenericKeyedObjectPool<K,T>
* <code>timeBetweenEvictionRunsMillis > 0</code> and attempts to ensure
* that each pool has the required minimum number of instances are only
* made during idle object eviction runs.
+ * <p>
+ * If the configured value of minIdlePerKey is greater than the configured
+ * value for maxIdlePerKey then the value of maxIdlePerKey will be used
+ * instead.
+ *
* @param poolSize - The minimum size of the each keyed pool
* @since Pool 1.3
* @see #getMinIdlePerKey
@@ -467,13 +472,23 @@ public class GenericKeyedObjectPool<K,T>
* <code>timeBetweenEvictionRunsMillis > 0</code> and attempts to ensure
* that each pool has the required minimum number of instances are only
* made during idle object eviction runs.
+ * <p>
+ * If the configured value of minIdlePerKey is greater than the configured
+ * value for maxIdlePerKey then the value of maxIdlePerKey will be used
+ * instead.
+ *
* @return minimum size of the each keyed pool
* @since Pool 1.3
* @see #setTimeBetweenEvictionRunsMillis
*/
@Override
public int getMinIdlePerKey() {
- return minIdlePerKey;
+ int maxIdlePerKey = getMaxIdlePerKey();
+ if (this.minIdlePerKey > maxIdlePerKey) {
+ return maxIdlePerKey;
+ } else {
+ return minIdlePerKey;
+ }
}
/**