commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r937467 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
Date Fri, 23 Apr 2010 18:57:40 GMT
Author: sebb
Date: Fri Apr 23 18:57:40 2010
New Revision: 937467

URL: http://svn.apache.org/viewvc?rev=937467&view=rev
Log:
POOL-166 GenericKeyedObjectPool.destroy could use entrySet() rather than keySet() followed
by get()

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=937467&r1=937466&r2=937467&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 Apr 23 18:57:40 2010
@@ -28,6 +28,7 @@ import java.util.NoSuchElementException;
 import java.util.Set;
 import java.util.TreeMap;
 import java.util.TimerTask;
+import java.util.Map.Entry;
 
 import org.apache.commons.pool.BaseKeyedObjectPool;
 import org.apache.commons.pool.KeyedObjectPool;
@@ -1455,9 +1456,10 @@ public class GenericKeyedObjectPool exte
      * @param factory KeyedPoolableObjectFactory used to destroy the objects
      */
     private void destroy(Map m, KeyedPoolableObjectFactory factory) {
-        for (Iterator keys = m.keySet().iterator(); keys.hasNext();) {
-            Object key = keys.next();
-            Collection c = (Collection) m.get(key);
+        for (Iterator entries = m.entrySet().iterator(); entries.hasNext();) {
+            Map.Entry entry = (Entry) entries.next();
+            Object key = entry.getKey();
+            Collection c = (Collection) entry.getValue();
             for (Iterator it = c.iterator(); it.hasNext();) {
                 try {
                     factory.destroyObject(



Mime
View raw message