Can you explain - maybe in the JIRA - what the problem is here and how the change fixes it? I see there is a problem, but I am missing something on the resolution.

Also, I think the first _numActive-- needs to be guarded by a decrementNumActive test, else when addObjectToPool is called by addObject, you will incorrectly decrement the active count. The fact that no test failed after this change means either 1) I am missing something or 2) we are missing tests on how addObject works with _numActive.

Phil

ma...@apache.org wrote:
Author: markt
Date: Wed May 13 22:44:48 2009
New Revision: 774576

URL: http://svn.apache.org/viewvc?rev=774576&view=rev
Log:
Fix POOL-135 for GOP.

Modified:
    
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java

Modified: 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL: 
http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=774576&r1=774575&r2=774576&view=diff
==============================================================================
--- 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
 (original)
+++ 
commons/proper/pool/trunk/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
 Wed May 13 22:44:48 2009
@@ -1149,6 +1149,8 @@
                     } else {
                         _pool.addLast(new ObjectTimestampPair(obj));
                     }
+                    _numActive--;
+                    notifyAll();
                 }
             }
         }
@@ -1160,15 +1162,15 @@
             } catch(Exception e) {
                 // ignored
             }
-        }
- - // Decrement active count *after* destroy if applicable
-        if (decrementNumActive) {
-            synchronized(this) {
-                _numActive--;
-                notifyAll();
+            // Decrement active count *after* destroy if applicable
+            if (decrementNumActive) {
+                synchronized(this) {
+                    _numActive--;
+                    notifyAll();
+                }
             }
         }
+ } public void close() throws Exception {




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to