Author: markt
Date: Thu Apr 12 19:39:14 2012
New Revision: 1325462
URL: http://svn.apache.org/viewvc?rev=1325462&view=rev
Log:
POOL-212. If minIdle > maxIdle use maxIdle in place of minIdle
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
Modified:
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
URL:
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1325462&r1=1325461&r2=1325462&view=diff
==============================================================================
---
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
(original)
+++
commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
Thu Apr 12 19:39:14 2012
@@ -385,6 +385,9 @@ public class GenericObjectPool<T> extend
* when <code>numActive + numIdle >= maxActive.</code> This setting has no
* effect if the idle object evictor is disabled (i.e. if
* <code>timeBetweenEvictionRunsMillis <= 0</code>).
+ * <p>
+ * If the configured value of minIdle is greater than the configured value
+ * for maxIdle then the value of maxIdle will be used instead.
*
* @param minIdle
* The minimum number of objects.
@@ -399,13 +402,21 @@ public class GenericObjectPool<T> extend
* Returns the minimum number of objects allowed in the pool before the
* evictor thread (if active) spawns new objects. (Note no objects are
* created when: numActive + numIdle >= maxActive)
+ * <p>
+ * If the configured value of minIdle is greater than the configured value
+ * for maxIdle then the value of maxIdle will be used instead.
*
* @return The minimum number of objects.
* @see #setMinIdle
*/
@Override
public int getMinIdle() {
- return minIdle;
+ int maxIdle = getMaxIdle();
+ if (this.minIdle > maxIdle) {
+ return maxIdle;
+ } else {
+ return minIdle;
+ }
}
/**