You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2011/05/17 22:21:47 UTC

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

Author: markt
Date: Tue May 17 20:21:47 2011
New Revision: 1104524

URL: http://svn.apache.org/viewvc?rev=1104524&view=rev
Log:
Improve field name. Better comment.

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

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java?rev=1104524&r1=1104523&r2=1104524&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool2/impl/GenericObjectPool.java Tue May 17 20:21:47 2011
@@ -1630,9 +1630,9 @@ public class GenericObjectPool<T> extend
      */
     private PooledObject<T> create(boolean force) throws Exception {
         int maxActive = getMaxActive();
-        int newNumActive = numActive.incrementAndGet();
+        int newNumActive = createCount.incrementAndGet();
         if (!force && maxActive > -1 && newNumActive > maxActive) {
-            numActive.decrementAndGet();
+            createCount.decrementAndGet();
             return null;
         }
 
@@ -1640,7 +1640,7 @@ public class GenericObjectPool<T> extend
         try {
             t = _factory.makeObject();
         } catch (Exception e) {
-            numActive.decrementAndGet();
+            createCount.decrementAndGet();
             throw e;
         }
 
@@ -1655,7 +1655,7 @@ public class GenericObjectPool<T> extend
         try {
             _factory.destroyObject(toDestory.getObject());
         } finally {
-            numActive.decrementAndGet();
+            createCount.decrementAndGet();
         }
     }
 
@@ -2034,12 +2034,13 @@ public class GenericObjectPool<T> extend
     private Map<T, PooledObject<T>> _allObjects = null;
 
     /**
-     * The combined count of the currently active objects and those in the
+     * The combined count of the currently created objects and those in the
      * process of being created. Under load, it may exceed {@link #_maxActive}
-     * but there will never be more than {@link #_maxActive} created at any one
-     * time.
+     * if multiple threads try and create a new object at the same time but
+     * {@link #create(boolean)} will ensure that there are never more than
+     * {@link #_maxActive} objects created at any one time.
      */
-    private AtomicInteger numActive = new AtomicInteger(0);
+    private AtomicInteger createCount = new AtomicInteger(0);
 
     /** The queue of idle objects */
     private LinkedBlockingDeque<PooledObject<T>> _idleObjects = null;