You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ps...@apache.org on 2011/09/21 23:48:15 UTC

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

Author: psteitz
Date: Wed Sep 21 21:48:15 2011
New Revision: 1173881

URL: http://svn.apache.org/viewvc?rev=1173881&view=rev
Log:
Wait to invalidate instance to be destroyed until we have removed it from the pool; otherwise a client could have already grabbed it. Saw this once in testClearOldest.

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=1173881&r1=1173880&r2=1173881&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 Wed Sep 21 21:48:15 2011
@@ -1343,7 +1343,6 @@ public class GenericKeyedObjectPool<K,T>
             throws Exception {
         
         register(key);
-        toDestroy.invalidate();
 
         try {
             ObjectDeque<T> objectDeque = poolMap.get(key);
@@ -1351,6 +1350,7 @@ public class GenericKeyedObjectPool<K,T>
             
             if (isIdle || always) {
                 objectDeque.getAllObjects().remove(toDestroy.getObject());
+                toDestroy.invalidate();
         
                 try {
                     _factory.destroyObject(key, toDestroy.getObject());