commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@apache.org
Subject svn commit: r1332964 - /commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Date Wed, 02 May 2012 09:28:26 GMT
Author: markt
Date: Wed May  2 09:28:25 2012
New Revision: 1332964

URL: http://svn.apache.org/viewvc?rev=1332964&view=rev
Log:
Fix POOL-216. Efficiency improvements.

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

Modified: commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java?rev=1332964&r1=1332963&r2=1332964&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/main/java/org/apache/commons/pool2/impl/GenericKeyedObjectPool.java
Wed May  2 09:28:25 2012
@@ -1200,8 +1200,8 @@ public class GenericKeyedObjectPool<K,T>
      */
     @Override
     protected void ensureMinIdle() throws Exception {
-        int minIdle = getMinIdlePerKey();
-        if (minIdle < 1) {
+        int minIdlePerKey = getMinIdlePerKey();
+        if (minIdlePerKey < 1) {
             return;
         }
 
@@ -1223,10 +1223,6 @@ public class GenericKeyedObjectPool<K,T>
      * @throws Exception If there was an error whilst creating the pooled objects
      */
     private void ensureMinIdle(K key) throws Exception {
-        int minIdle = getMinIdlePerKey();
-        if (minIdle < 1) {
-            return;
-        }
 
         // Calculate current pool objects
         ObjectDeque<T> objectDeque = poolMap.get(key);
@@ -1305,6 +1301,10 @@ public class GenericKeyedObjectPool<K,T>
      * @since Pool 1.3
      */
     public void preparePool(K key) throws Exception {
+        int minIdlePerKey = getMinIdlePerKey();
+        if (minIdlePerKey < 1) {
+            return;
+        }
         ensureMinIdle(key);
     }
 



Mime
View raw message