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 2009/06/19 17:59:23 UTC

svn commit: r786564 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java

Author: markt
Date: Fri Jun 19 15:59:22 2009
New Revision: 786564

URL: http://svn.apache.org/viewvc?rev=786564&view=rev
Log:
Fix POOL-145. Don't check the same idle object multiple times in a single evictor run.

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java?rev=786564&r1=786563&r2=786564&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java Fri Jun 19 15:59:22 2009
@@ -905,7 +905,7 @@
     }
 
     /**
-     * Returns the number of objects to examine during each run of the
+     * Returns the max number of objects to examine during each run of the
      * idle object evictor thread (if any).
      *
      * @return number of objects to examine each eviction run.
@@ -917,7 +917,7 @@
     }
 
     /**
-     * Sets the number of objects to examine during each run of the
+     * Sets the max number of objects to examine during each run of the
      * idle object evictor thread (if any).
      * <p>
      * When a negative value is supplied, 
@@ -2051,7 +2051,7 @@
 
     private synchronized int getNumTests() {
         if (_numTestsPerEvictionRun >= 0) {
-            return _numTestsPerEvictionRun;
+            return Math.min(_numTestsPerEvictionRun, _totalIdle);
         } else {
             return(int)(Math.ceil(_totalIdle/Math.abs((double)_numTestsPerEvictionRun)));
         }