commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r602912 - in /commons/proper/pool/trunk/src/java/org/apache/commons/pool: ./ composite/
Date Mon, 10 Dec 2007 14:34:22 GMT
Author: sebb
Date: Mon Dec 10 06:34:21 2007
New Revision: 602912

URL: http://svn.apache.org/viewvc?rev=602912&view=rev
Log:
Revert changes 602600 and 602598 - reinstate assert statements

Modified:
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractLender.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractManager.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FailManager.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FifoLender.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/GrowManager.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/IdleLimitManager.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/LifoLender.java
    commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/WaitLimitManager.java

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/PoolUtils.java Mon Dec 10 06:34:21
2007
@@ -17,12 +17,11 @@
 
 package org.apache.commons.pool;
 
-// used by assert code
-//import org.apache.commons.pool.impl.GenericKeyedObjectPool;
-//import org.apache.commons.pool.impl.StackKeyedObjectPool;
-//import org.apache.commons.pool.impl.GenericObjectPool;
-//import org.apache.commons.pool.impl.SoftReferenceObjectPool;
-//import org.apache.commons.pool.impl.StackObjectPool;
+import org.apache.commons.pool.impl.GenericKeyedObjectPool;
+import org.apache.commons.pool.impl.StackKeyedObjectPool;
+import org.apache.commons.pool.impl.GenericObjectPool;
+import org.apache.commons.pool.impl.SoftReferenceObjectPool;
+import org.apache.commons.pool.impl.StackObjectPool;
 
 import java.util.Collection;
 import java.util.HashMap;
@@ -350,14 +349,14 @@
         if (pool == null) {
             throw new IllegalArgumentException("pool must not be null.");
         }
-//        assert !(pool instanceof GenericObjectPool)
-//                : "GenericObjectPool is already thread-safe";
-//        assert !(pool instanceof SoftReferenceObjectPool)
-//                : "SoftReferenceObjectPool is already thread-safe";
-//        assert !(pool instanceof StackObjectPool)
-//                : "StackObjectPool is already thread-safe";
-//        assert !"org.apache.commons.pool.composite.CompositeObjectPool".equals(pool.getClass().getName())
-//                : "CompositeObjectPools are already thread-safe";
+        assert !(pool instanceof GenericObjectPool)
+                : "GenericObjectPool is already thread-safe";
+        assert !(pool instanceof SoftReferenceObjectPool)
+                : "SoftReferenceObjectPool is already thread-safe";
+        assert !(pool instanceof StackObjectPool)
+                : "StackObjectPool is already thread-safe";
+        assert !"org.apache.commons.pool.composite.CompositeObjectPool".equals(pool.getClass().getName())
+                : "CompositeObjectPools are already thread-safe";
         return new SynchronizedObjectPool(pool);
     }
 
@@ -379,12 +378,12 @@
         if (keyedPool == null) {
             throw new IllegalArgumentException("keyedPool must not be null.");
         }
-//        assert !(keyedPool instanceof GenericKeyedObjectPool)
-//                : "GenericKeyedObjectPool is already thread-safe";
-//        assert !(keyedPool instanceof StackKeyedObjectPool)
-//                : "StackKeyedObjectPool is already thread-safe";
-//        assert !"org.apache.commons.pool.composite.CompositeKeyedObjectPool".equals(keyedPool.getClass().getName())
-//                : "CompositeKeyedObjectPools are already thread-safe";
+        assert !(keyedPool instanceof GenericKeyedObjectPool)
+                : "GenericKeyedObjectPool is already thread-safe";
+        assert !(keyedPool instanceof StackKeyedObjectPool)
+                : "StackKeyedObjectPool is already thread-safe";
+        assert !"org.apache.commons.pool.composite.CompositeKeyedObjectPool".equals(keyedPool.getClass().getName())
+                : "CompositeKeyedObjectPools are already thread-safe";
         return new SynchronizedKeyedObjectPool(keyedPool);
     }
 

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractLender.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractLender.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractLender.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractLender.java
Mon Dec 10 06:34:21 2007
@@ -51,7 +51,7 @@
 
     public void repay(final Object obj) {
         final List pool = getObjectPool().getPool();
-//        assert Thread.holdsLock(pool);
+        assert Thread.holdsLock(pool);
         pool.add(obj);
         pool.notifyAll();
     }

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractManager.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractManager.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractManager.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/AbstractManager.java
Mon Dec 10 06:34:21 2007
@@ -86,7 +86,7 @@
      * @param obj the object to return to the pool.
      */
     public void returnToPool(final Object obj) {
-//        assert Thread.holdsLock(objectPool.getPool());
+        assert Thread.holdsLock(objectPool.getPool());
         objectPool.getLender().repay(obj);
     }
 

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FailManager.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FailManager.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FailManager.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FailManager.java
Mon Dec 10 06:34:21 2007
@@ -55,7 +55,7 @@
      * @throws Exception usually from {@link PoolableObjectFactory} methods.
      */
     public Object nextFromPool() throws Exception {
-//        assert Thread.holdsLock(objectPool.getPool());
+        assert Thread.holdsLock(objectPool.getPool());
         Object obj = null;
         // Drain until good or empty
         while (objectPool.getLender().size() > 0 && obj == null) {

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FifoLender.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FifoLender.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FifoLender.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/FifoLender.java Mon
Dec 10 06:34:21 2007
@@ -35,7 +35,7 @@
 
     public Object borrow() {
         final List pool = getObjectPool().getPool();
-//        assert Thread.holdsLock(pool);
+        assert Thread.holdsLock(pool);
         if (pool instanceof LinkedList) {
             return ((LinkedList)pool).removeFirst();
         } else {

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/GrowManager.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/GrowManager.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/GrowManager.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/GrowManager.java
Mon Dec 10 06:34:21 2007
@@ -49,7 +49,7 @@
      * @throws Exception when {@link PoolableObjectFactory#makeObject()} fails.
      */
     public Object nextFromPool() throws Exception {
-//        assert Thread.holdsLock(objectPool.getPool());
+        assert Thread.holdsLock(objectPool.getPool());
         Object obj = null;
 
         final long startActivateTime = System.currentTimeMillis();

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/IdleLimitManager.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/IdleLimitManager.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/IdleLimitManager.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/IdleLimitManager.java
Mon Dec 10 06:34:21 2007
@@ -49,7 +49,7 @@
      * @param obj the object to return to the pool.
      */
     public void returnToPool(final Object obj) {
-//        assert Thread.holdsLock(objectPool.getPool());
+        assert Thread.holdsLock(objectPool.getPool());
         if (maxIdle > 0 && maxIdle <= objectPool.getNumIdle()) {
             // XXX Does this remove the most stale object in
             final ListIterator iter = objectPool.getLender().listIterator();

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/LifoLender.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/LifoLender.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/LifoLender.java (original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/LifoLender.java Mon
Dec 10 06:34:21 2007
@@ -35,7 +35,7 @@
 
     public Object borrow() {
         final List pool = getObjectPool().getPool();
-//        assert Thread.holdsLock(pool);
+        assert Thread.holdsLock(pool);
         if (pool instanceof LinkedList) {
             return ((LinkedList)pool).removeLast();
         } else {

Modified: commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/WaitLimitManager.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/WaitLimitManager.java?rev=602912&r1=602911&r2=602912&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/WaitLimitManager.java
(original)
+++ commons/proper/pool/trunk/src/java/org/apache/commons/pool/composite/WaitLimitManager.java
Mon Dec 10 06:34:21 2007
@@ -53,7 +53,7 @@
      */
     public Object nextFromPool() throws NoSuchElementException, Exception, InterruptedException
{
         final Object poolLock = objectPool.getPool();
-//        assert Thread.holdsLock(poolLock);
+        assert Thread.holdsLock(poolLock);
         final long endTime = maxWaitMillis > 0 ? System.currentTimeMillis() + maxWaitMillis
: Long.MAX_VALUE;
         while (maxWaitMillis <= 0 || endTime > System.currentTimeMillis()) {
             if (Thread.currentThread().isInterrupted()) {



Mime
View raw message