commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From simonetrip...@apache.org
Subject svn commit: r1052190 - /commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
Date Thu, 23 Dec 2010 07:34:41 GMT
Author: simonetripodi
Date: Thu Dec 23 07:34:41 2010
New Revision: 1052190

URL: http://svn.apache.org/viewvc?rev=1052190&view=rev
Log:
_numActive is also incremented in borrowObject() method, so access to this data member needs
to be protected, thanks Phil

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

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java?rev=1052190&r1=1052189&r2=1052190&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/StackObjectPool.java
Thu Dec 23 07:34:41 2010
@@ -226,7 +226,7 @@ public class StackObjectPool<T> extends 
      * @return the number of instances currently borrowed from this pool
      */
     @Override
-    public int getNumActive() {
+    public synchronized int getNumActive() {
         return _numActive;
     }
 
@@ -337,7 +337,7 @@ public class StackObjectPool<T> extends 
     /**
      * Number of objects borrowed but not yet returned to the pool.
      */
-    private volatile int _numActive = 0;
+    private int _numActive = 0;
 
     /**
      * Returns the {@link PoolableObjectFactory} used by this pool to create and manage object
instances.



Mime
View raw message