On 2 May 2012 10:28, <ma...@apache.org> wrote: > 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) {
There's actually no need for the local variable minIdlePerKey. Not sure that is worth fixing though; it can also make debugging marginally harder. > + return; > + } > ensureMinIdle(key); > } > > > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org