Author: markt
Date: Thu Sep 1 12:21:31 2011
New Revision: 1164036
URL: http://svn.apache.org/viewvc?rev=1164036&view=rev
Log:
Remove sync that wasn't helping.
Make thread safe
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=1164036&r1=1164035&r2=1164036&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 Sep 1 12:21:31 2011
@@ -1560,12 +1560,13 @@ public class GenericKeyedObjectPool<K,T>
* @see #setNumTestsPerEvictionRun
* @return the number of tests for the Evictor to run
*/
- private synchronized int getNumTests() {
+ private int getNumTests() {
int totalIdle = getNumIdle();
- if (_numTestsPerEvictionRun >= 0) {
- return Math.min(_numTestsPerEvictionRun, totalIdle);
+ int numTests = _numTestsPerEvictionRun;
+ if (numTests >= 0) {
+ return Math.min(numTests, totalIdle);
}
-
return(int)(Math.ceil(totalIdle/Math.abs((double)_numTestsPerEvictionRun)));
+ return(int)(Math.ceil(totalIdle/Math.abs((double)numTests)));
}
/**