commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pste...@apache.org
Subject svn commit: r605736 - in /commons/proper/pool/branches/1_4_RELEASE_BRANCH: src/java/org/apache/commons/pool/impl/ src/test/org/apache/commons/pool/ src/test/org/apache/commons/pool/impl/ xdocs/
Date Wed, 19 Dec 2007 23:25:51 GMT
Author: psteitz
Date: Wed Dec 19 15:25:47 2007
New Revision: 605736

URL: http://svn.apache.org/viewvc?rev=605736&view=rev
Log:
Reverted post-1.3 changes to forego validation for newly created instances
and default testOnBorrow settings for GenericObjectPool,
GenericKeyedObjectPool, StackObjectPool, StackKeyedObjectPool,
SoftReferenceObjectPool.

Made behavior on instance validation failure consistent across pools,
eliminating possible infinite loops in StackObjectPool, StackKeyedObjectPool,
SoftReferenceObjectPool when factory fails to create valid objects. 

JIRA: 

Modified:
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestKeyedObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
    commons/proper/pool/branches/1_4_RELEASE_BRANCH/xdocs/changes.xml

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericKeyedObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -226,7 +226,7 @@
      * @see #getTestOnBorrow
      * @see #setTestOnBorrow
      */
-    public static final boolean DEFAULT_TEST_ON_BORROW = true;
+    public static final boolean DEFAULT_TEST_ON_BORROW = false;
 
     /**
      * The default "test on return" value.
@@ -926,45 +926,54 @@
                 }
                 pool.incrementActiveCount();
             }
-            if (newlyCreated) {
-                return pair.value;
-            } else {
+            
+            // Activate.  If activate fails, decrement active count and destroy.
+            // If instance failing activation is new, throw NoSuchElementException;
+            // otherwise keep looping
+            try {
+                _factory.activateObject(key, pair.value);
+            } catch (Exception e) {
                 try {
-                    _factory.activateObject(key, pair.value);
-                } catch (Exception e) {
-                    try {
-                        synchronized (this) {
-                            pool.decrementActiveCount();
-                        }
-                        _factory.destroyObject(key,pair.value);
-                    } catch (Exception e2) {
-                        // swallowed
+                    synchronized (this) {
+                        pool.decrementActiveCount();
                     }
-                    continue;
+                    _factory.destroyObject(key,pair.value);
+                } catch (Exception e2) {
+                    // swallowed
+                }
+                if(newlyCreated) {
+                    throw new NoSuchElementException(
+                       "Could not create a validated object, cause: "
+                            + e.getMessage());
                 }
+                else {
+                    continue; // keep looping
+                }
+            }
 
-                boolean invalid = true;
+            // Validate.  If validation fails, decrement active count and
+            // destroy. If instance failing validation is new, throw
+            // NoSuchElementException; otherwise keep looping
+            boolean invalid = true;
+            try {
+                invalid = _testOnBorrow && !_factory.validateObject(key, pair.value);
+            } catch (Exception e) {
+                // swallowed
+            }
+            if (invalid) {
                 try {
-                    invalid = _testOnBorrow && !_factory.validateObject(key, pair.value);
+                    synchronized (this) {
+                        pool.decrementActiveCount();
+                    }
+                    _factory.destroyObject(key,pair.value);
                 } catch (Exception e) {
                     // swallowed
                 }
-                if (invalid) {
-                    try {
-                        synchronized (this) {
-                            pool.decrementActiveCount();
-                        }
-                        _factory.destroyObject(key,pair.value);
-                    } catch (Exception e) {
-                        // swallowed
-                    }
-                    if(newlyCreated) {
-                        throw new NoSuchElementException("Could not create a validated object");
-                    } // else keep looping
-                } else {
-                    return pair.value;
-                }
-
+                if(newlyCreated) {
+                    throw new NoSuchElementException("Could not create a validated object");
+                } // else keep looping
+            } else {
+                return pair.value;
             }
         }
     }

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/GenericObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -129,7 +129,7 @@
  * in the idle object pool.
  * <ul>
  *  <li>
- *   {@link #setLifo <i>Lifo</i>}
+ *   {@link #setLifo <i>lifo</i>}
  *   determines whether or not the pool returns idle objects in 
  *   last-in-first-out order.
  *  </li>
@@ -243,7 +243,7 @@
      * @see #getTestOnBorrow
      * @see #setTestOnBorrow
      */
-    public static final boolean DEFAULT_TEST_ON_BORROW = true;
+    public static final boolean DEFAULT_TEST_ON_BORROW = false;
 
     /**
      * The default "test on return" value.
@@ -940,7 +940,6 @@
                     Object obj = _factory.makeObject();
                     pair = new ObjectTimestampPair(obj);
                     newlyCreated = true;
-                    return pair.value;
                 } finally {
                     if (!newlyCreated) {
                         // object cannot be created

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/SoftReferenceObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -99,33 +99,24 @@
                 obj = ref.get();
                 ref.clear(); // prevent this ref from being enqueued with refQueue.
             }
-            if (!newlyCreated && null != _factory && null != obj) {
+            if (null != _factory && null != obj) {
                 try {
                     _factory.activateObject(obj);
-                } catch (Exception e) {
-                    try {
-                        _factory.destroyObject(obj);
-                    } catch (Exception e2) {
-                        // swallowed
-                    } finally {
-                        obj = null;
+                    if (!_factory.validateObject(obj)) {
+                        throw new Exception("ValidateObject failed");
                     }
-                }
-            }
-            if (!newlyCreated && null != _factory && null != obj) {
-                boolean validated = false;
-                try {
-                    validated = _factory.validateObject(obj);
-                } catch (Exception e) {
-                    // swallowed
-                }
-                if (!validated) {
+                } catch (Throwable t) {
                     try {
                         _factory.destroyObject(obj);
-                    } catch(Exception e) {
+                    } catch (Throwable t2) {
                         // swallowed
                     } finally {
                         obj = null;
+                    }
+                    if (newlyCreated) {
+                        throw new NoSuchElementException(
+                            "Could not create a validated object, cause: " +
+                            t.getMessage());
                     }
                 }
             }

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackKeyedObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -154,24 +154,25 @@
                     newlyMade = true;
                 }
             }
-            if(!newlyMade && null != obj && null != _factory) {
+            if (null != _factory && null != obj) {
                 try {
                     _factory.activateObject(key, obj);
                     if (!_factory.validateObject(key, obj)) {
-                        try {
-                            _factory.destroyObject(key, obj);
-                        } catch (Exception e2) {
-                            // swallowed
-                        }
-                        obj = null;
+                        throw new Exception("ValidateObject failed");
                     }
-                } catch (Exception e) {
+                } catch (Throwable t) {
                     try {
-                        _factory.destroyObject(key, obj);
-                    } catch (Exception e2) {
+                        _factory.destroyObject(key,obj);
+                    } catch (Throwable t2) {
                         // swallowed
+                    } finally {
+                        obj = null;
+                    } 
+                    if (newlyMade) {
+                        throw new NoSuchElementException(
+                            "Could not create a validated object, cause: " +
+                            t.getMessage());
                     }
-                    obj = null;
                 }
             }
         } while (obj == null);

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/java/org/apache/commons/pool/impl/StackObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -146,40 +146,31 @@
                 if(null == _factory) {
                     throw new NoSuchElementException();
                 } else {
-                    newlyCreated = true;
                     obj = _factory.makeObject();
+                    newlyCreated = true;
                   if (obj == null) {
                     throw new NoSuchElementException("PoolableObjectFactory.makeObject()
returned null.");
                   }
                 }
             }
-            if (!newlyCreated && null != _factory && null != obj) {
+            if (null != _factory && null != obj) {
                 try {
                     _factory.activateObject(obj);
-                } catch (Exception e) {
-                    try {
-                        _factory.destroyObject(obj);
-                    } catch (Exception e2) {
-                        // swallowed
-                    } finally {
-                        obj = null;
+                    if (!_factory.validateObject(obj)) {
+                        throw new Exception("ValidateObject failed");
                     }
-                }
-            }
-            if (!newlyCreated && null != _factory && null != obj) {
-                boolean validated = false;
-                try {
-                    validated = _factory.validateObject(obj);
-                } catch (Exception e) {
-                    // swallowed
-                }
-                if (!validated) {
+                } catch (Throwable t) {
                     try {
                         _factory.destroyObject(obj);
-                    } catch(Exception e) {
+                    } catch (Throwable t2) {
                         // swallowed
                     } finally {
                         obj = null;
+                    } 
+                    if (newlyCreated) {
+                        throw new NoSuchElementException(
+                            "Could not create a validated object, cause: " +
+                            t.getMessage());
                     }
                 }
             }

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestKeyedObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestKeyedObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestKeyedObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -20,6 +20,9 @@
 
 import java.util.List;
 import java.util.ArrayList;
+import java.util.NoSuchElementException;
+
+import org.apache.commons.pool.impl.GenericKeyedObjectPool;
 
 /**
  * Abstract {@link TestCase} for {@link ObjectPool} implementations.
@@ -146,6 +149,10 @@
         }
         final List expectedMethods = new ArrayList();
         Object obj;
+        
+        if (pool instanceof GenericKeyedObjectPool) {
+            ((GenericKeyedObjectPool) pool).setTestOnBorrow(true);
+        }
 
         /// Test correct behavior code paths
 
@@ -180,11 +187,18 @@
 
         factory.setActivateObjectFail(true);
         expectedMethods.add(new MethodCall("activateObject", KEY, obj));
-        obj = pool.borrowObject(KEY);
+        try {
+            obj = pool.borrowObject(KEY); 
+            fail("Expecting NoSuchElementException");
+        } catch (NoSuchElementException e) {
+            //Activate should fail
+        }
+        // After idle object fails validation, new on is created and activation
+        // fails again for the new one.
         expectedMethods.add(new MethodCall("makeObject", KEY).returned(ONE));
+        expectedMethods.add(new MethodCall("activateObject", KEY, ONE));
         TestObjectPool.removeDestroyObjectCall(factory.getMethodCalls()); // The exact timing
of destroyObject is flexible here.
         assertEquals(expectedMethods, factory.getMethodCalls());
-        pool.returnObject(KEY, obj);
 
         // when validateObject fails in borrowObject, a new object should be borrowed/created
         reset(pool, factory, expectedMethods);
@@ -192,13 +206,23 @@
         clear(factory, expectedMethods);
 
         factory.setValidateObjectFail(true);
+        // testOnBorrow is on, so this will throw when the newly created instance
+        // fails validation
+        try {
+            obj = pool.borrowObject(KEY);
+            fail("Expecting NoSuchElementException");
+        } catch (NoSuchElementException ex) {
+            // expected
+        }
+        // Activate, then validate for idle instance
         expectedMethods.add(new MethodCall("activateObject", KEY, ZERO));
         expectedMethods.add(new MethodCall("validateObject", KEY, ZERO));
-        obj = pool.borrowObject(KEY);
+        // Make new instance, activate succeeds, validate fails
         expectedMethods.add(new MethodCall("makeObject", KEY).returned(ONE));
-        TestObjectPool.removeDestroyObjectCall(factory.getMethodCalls()); // The exact timing
of destroyObject is flexible here.
+        expectedMethods.add(new MethodCall("activateObject", KEY, ONE));
+        expectedMethods.add(new MethodCall("validateObject", KEY, ONE));
+        TestObjectPool.removeDestroyObjectCall(factory.getMethodCalls());
         assertEquals(expectedMethods, factory.getMethodCalls());
-        pool.returnObject(KEY, obj);
     }
 
     public void testKPOFReturnObjectUsages() throws Exception {

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/TestObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -17,10 +17,12 @@
 package org.apache.commons.pool;
 
 import junit.framework.TestCase;
+import org.apache.commons.pool.impl.GenericObjectPool;
 
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Iterator;
+import java.util.NoSuchElementException;
 
 /**
  * Abstract {@link TestCase} for {@link ObjectPool} implementations.
@@ -154,6 +156,9 @@
         } catch (UnsupportedOperationException uoe) {
             return; // test not supported
         }
+        if (pool instanceof GenericObjectPool) {
+            ((GenericObjectPool) pool).setTestOnBorrow(true);
+        }
         final List expectedMethods = new ArrayList();
         Object obj;
 
@@ -190,11 +195,17 @@
 
         factory.setActivateObjectFail(true);
         expectedMethods.add(new MethodCall("activateObject", obj));
-        obj = pool.borrowObject();
+        try {
+            obj = pool.borrowObject();
+            fail("Expecting NoSuchElementException");
+        } catch (NoSuchElementException ex) {
+            // Expected - newly created object will also fail to activate
+        }
+        // Idle object fails activation, new one created, also fails
         expectedMethods.add(new MethodCall("makeObject").returned(ONE));
+        expectedMethods.add(new MethodCall("activateObject", ONE));
         removeDestroyObjectCall(factory.getMethodCalls()); // The exact timing of destroyObject
is flexible here.
         assertEquals(expectedMethods, factory.getMethodCalls());
-        pool.returnObject(obj);
 
         // when validateObject fails in borrowObject, a new object should be borrowed/created
         reset(pool, factory, expectedMethods);
@@ -204,11 +215,19 @@
         factory.setValidateObjectFail(true);
         expectedMethods.add(new MethodCall("activateObject", ZERO));
         expectedMethods.add(new MethodCall("validateObject", ZERO));
-        obj = pool.borrowObject();
+        try {
+            obj = pool.borrowObject();
+        } catch (NoSuchElementException ex) {
+            // Expected - newly created object will also fail to validate
+        }
+        // Idle object is activated, but fails validation.
+        // New instance is created, activated and then fails validation
         expectedMethods.add(new MethodCall("makeObject").returned(ONE));
+        expectedMethods.add(new MethodCall("activateObject", ONE));
+        expectedMethods.add(new MethodCall("validateObject", ONE));
         removeDestroyObjectCall(factory.getMethodCalls()); // The exact timing of destroyObject
is flexible here.
-        assertEquals(expectedMethods, factory.getMethodCalls());
-        pool.returnObject(obj);
+        // Second activate and validate are missing from expectedMethods
+        assertTrue(factory.getMethodCalls().containsAll(expectedMethods));
     }
 
     public void testPOFReturnObjectUsages() throws Exception {

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackKeyedObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -261,12 +261,33 @@
 
         Object[] obj = new Object[10];
         for(int i=0;i<10;i++) {
-            obj[i] = pool.borrowObject("key");
+            Object object = null;
+            int k = 0;
+            while (object == null && k < 100) { // bound not really needed
+                try {
+                    k++;
+                    object = pool.borrowObject("key");
+                    obj[i] = object;
+                } catch (NoSuchElementException ex) {
+                    // Expected for evens, which fail validation
+                }
+            }
+            assertEquals("Each time we borrow, get one more active.", i+1, pool.getNumActive());
         }
+        // 1,3,5,...,19 pass validation, get checked out
         for(int i=0;i<10;i++) {
             pool.returnObject("key",obj[i]);
+            assertEquals("Each time we borrow, get one less active.", 9-i, pool.getNumActive());
         }
-        assertEquals(6,pool.getNumIdle("key"));
+        // 3, 9, 15 fail passivation.  
+        assertEquals(7,pool.getNumIdle());
+        assertEquals(new Integer(19), (Integer) pool.borrowObject("key"));
+        assertEquals(new Integer(17), (Integer) pool.borrowObject("key"));
+        assertEquals(new Integer(13), (Integer) pool.borrowObject("key"));
+        assertEquals(new Integer(11), (Integer) pool.borrowObject("key"));
+        assertEquals(new Integer(7), (Integer) pool.borrowObject("key"));
+        assertEquals(new Integer(5), (Integer) pool.borrowObject("key"));
+        assertEquals(new Integer(1), (Integer) pool.borrowObject("key"));   
     }
 
     class SimpleFactory implements KeyedPoolableObjectFactory {

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
(original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/src/test/org/apache/commons/pool/impl/TestStackObjectPool.java
Wed Dec 19 15:25:47 2007
@@ -177,14 +177,33 @@
 
         Object[] obj = new Object[10];
         for(int i=0;i<10;i++) {
-            obj[i] = pool.borrowObject();
+            Object object = null;
+            int k = 0;
+            while (object == null && k < 100) { // bound not really needed
+                try {
+                    k++;
+                    object = pool.borrowObject();
+                    obj[i] = object;
+                } catch (NoSuchElementException ex) {
+                    // Expected for evens, which fail validation
+                }
+            }
             assertEquals("Each time we borrow, get one more active.", i+1, pool.getNumActive());
         }
+        // 1,3,5,...,19 pass validation, get checked out
         for(int i=0;i<10;i++) {
             pool.returnObject(obj[i]);
             assertEquals("Each time we borrow, get one less active.", 9-i, pool.getNumActive());
         }
-        assertEquals(6,pool.getNumIdle());
+        // 3, 9, 15 fail passivation.  
+        assertEquals(7,pool.getNumIdle());
+        assertEquals(new Integer(19), (Integer) pool.borrowObject());
+        assertEquals(new Integer(17), (Integer) pool.borrowObject());
+        assertEquals(new Integer(13), (Integer) pool.borrowObject());
+        assertEquals(new Integer(11), (Integer) pool.borrowObject());
+        assertEquals(new Integer(7), (Integer) pool.borrowObject());
+        assertEquals(new Integer(5), (Integer) pool.borrowObject());
+        assertEquals(new Integer(1), (Integer) pool.borrowObject());     
     }
     
     public void testBorrowReturnWithSometimesInvalidObjects() throws Exception {

Modified: commons/proper/pool/branches/1_4_RELEASE_BRANCH/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/commons/proper/pool/branches/1_4_RELEASE_BRANCH/xdocs/changes.xml?rev=605736&r1=605735&r2=605736&view=diff
==============================================================================
--- commons/proper/pool/branches/1_4_RELEASE_BRANCH/xdocs/changes.xml (original)
+++ commons/proper/pool/branches/1_4_RELEASE_BRANCH/xdocs/changes.xml Wed Dec 19 15:25:47
2007
@@ -96,6 +96,12 @@
         a Config instance as a parameter. The minIdle setting in the Config
         was being ignored by the constructor.
       </action>
+      <action def="psteitz" type="fix" issue="POOL-117">
+        Made behavior on instance validation failure consistent across pools,
+        eliminating possible infinite loops in StackObjectPool,
+        StackKeyedObjectPool, SoftReferenceObjectPool when factory fails to
+        create valid objects. 
+      </action>
     </release>
 
     <release version="1.3" date="2006-04-06" description="1.x bugfix release">



Mime
View raw message