You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2010/10/11 23:39:16 UTC

svn commit: r1021517 [4/5] - in /commons/proper/pool/trunk: ./ src/java/org/apache/commons/pool/ src/java/org/apache/commons/pool/impl/ src/test/org/apache/commons/pool/ src/test/org/apache/commons/pool/impl/ src/test/org/apache/commons/pool/performance/

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestKeyedObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestKeyedObjectPoolFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestKeyedObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestKeyedObjectPoolFactory.java Mon Oct 11 21:39:15 2010
@@ -33,32 +33,32 @@ public abstract class TestKeyedObjectPoo
     /**
      * @throws UnsupportedOperationException when this is unsupported by this KeyedPoolableObjectFactory type.
      */
-    protected KeyedObjectPoolFactory makeFactory() throws UnsupportedOperationException {
+    protected KeyedObjectPoolFactory<Object,Object> makeFactory() throws UnsupportedOperationException {
         return makeFactory(createObjectFactory());
     }
 
     /**
      * @throws UnsupportedOperationException when this is unsupported by this KeyedPoolableObjectFactory type.
      */
-    protected abstract KeyedObjectPoolFactory makeFactory(KeyedPoolableObjectFactory objectFactory) throws UnsupportedOperationException;
+    protected abstract KeyedObjectPoolFactory<Object,Object> makeFactory(KeyedPoolableObjectFactory<Object,Object> objectFactory) throws UnsupportedOperationException;
 
-    protected static KeyedPoolableObjectFactory createObjectFactory() {
+    protected static KeyedPoolableObjectFactory<Object,Object> createObjectFactory() {
         return PoolUtils.adapt(new MethodCallPoolableObjectFactory());
     }
 
     public void testCreatePool() throws Exception {
-        final KeyedObjectPoolFactory factory;
+        final KeyedObjectPoolFactory<Object,Object> factory;
         try {
             factory = makeFactory();
         } catch (UnsupportedOperationException uoe) {
             return;
         }
-        final KeyedObjectPool pool = factory.createPool();
+        final KeyedObjectPool<Object,Object> pool = factory.createPool();
         pool.close();
     }
 
     public void testToString() {
-        final KeyedObjectPoolFactory factory;
+        final KeyedObjectPoolFactory<Object,Object> factory;
         try {
             factory = makeFactory();
         } catch (UnsupportedOperationException uoe) {

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPool.java Mon Oct 11 21:39:15 2010
@@ -44,10 +44,10 @@ public abstract class TestObjectPool ext
      * Generally speaking there should be no limits on the various object counts.
      * @throws UnsupportedOperationException if the pool being tested does not follow pool contracts.
      */
-    protected abstract ObjectPool makeEmptyPool(PoolableObjectFactory factory) throws UnsupportedOperationException;
+    protected abstract ObjectPool<Object> makeEmptyPool(PoolableObjectFactory<Object> factory) throws UnsupportedOperationException;
 
     public void testClosedPoolBehavior() throws Exception {
-        final ObjectPool pool;
+        final ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(new MethodCallPoolableObjectFactory());
         } catch (UnsupportedOperationException uoe) {
@@ -102,13 +102,13 @@ public abstract class TestObjectPool ext
 
     public void testPOFAddObjectUsage() throws Exception {
         final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
-        final ObjectPool pool;
+        final ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(factory);
         } catch(UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List expectedMethods = new ArrayList();
+        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
 
         assertEquals(0, pool.getNumActive());
         assertEquals(0, pool.getNumIdle());
@@ -164,16 +164,16 @@ public abstract class TestObjectPool ext
 
     public void testPOFBorrowObjectUsages() throws Exception {
         final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
-        final ObjectPool pool;
+        final ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(factory);
         } catch (UnsupportedOperationException uoe) {
             return; // test not supported
         }
         if (pool instanceof GenericObjectPool) {
-            ((GenericObjectPool) pool).setTestOnBorrow(true);
+            ((GenericObjectPool<Object>) pool).setTestOnBorrow(true);
         }
-        final List expectedMethods = new ArrayList();
+        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -246,13 +246,13 @@ public abstract class TestObjectPool ext
 
     public void testPOFReturnObjectUsages() throws Exception {
         final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
-        final ObjectPool pool;
+        final ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(factory);
         } catch (UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List expectedMethods = new ArrayList();
+        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -307,13 +307,13 @@ public abstract class TestObjectPool ext
 
     public void testPOFInvalidateObjectUsages() throws Exception {
         final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
-        final ObjectPool pool;
+        final ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(factory);
         } catch (UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List expectedMethods = new ArrayList();
+        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
         Object obj;
 
         /// Test correct behavior code paths
@@ -344,13 +344,13 @@ public abstract class TestObjectPool ext
 
     public void testPOFClearUsages() throws Exception {
         final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
-        final ObjectPool pool;
+        final ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(factory);
         } catch (UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List expectedMethods = new ArrayList();
+        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
 
         /// Test correct behavior code paths
         PoolUtils.prefill(pool, 5);
@@ -365,13 +365,13 @@ public abstract class TestObjectPool ext
 
     public void testPOFCloseUsages() throws Exception {
         final MethodCallPoolableObjectFactory factory = new MethodCallPoolableObjectFactory();
-        ObjectPool pool;
+        ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(factory);
         } catch (UnsupportedOperationException uoe) {
             return; // test not supported
         }
-        final List expectedMethods = new ArrayList();
+        final List<MethodCall> expectedMethods = new ArrayList<MethodCall>();
 
         /// Test correct behavior code paths
         PoolUtils.prefill(pool, 5);
@@ -391,7 +391,7 @@ public abstract class TestObjectPool ext
     }
 
     public void testSetFactory() throws Exception {
-        ObjectPool pool;
+        ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(new MethodCallPoolableObjectFactory());
         } catch (UnsupportedOperationException uoe) {
@@ -406,7 +406,7 @@ public abstract class TestObjectPool ext
     }
 
     public void testToString() {
-        ObjectPool pool;
+        ObjectPool<Object> pool;
         try {
             pool = makeEmptyPool(new MethodCallPoolableObjectFactory());
         } catch (UnsupportedOperationException uoe) {
@@ -415,23 +415,23 @@ public abstract class TestObjectPool ext
         pool.toString();
     }
 
-    static void removeDestroyObjectCall(List calls) {
-        Iterator iter = calls.iterator();
+    static void removeDestroyObjectCall(List<MethodCall> calls) {
+        Iterator<MethodCall> iter = calls.iterator();
         while (iter.hasNext()) {
-            MethodCall call = (MethodCall)iter.next();
+            MethodCall call = iter.next();
             if ("destroyObject".equals(call.getName())) {
                 iter.remove();
             }
         }
     }
 
-    private static void reset(final ObjectPool pool, final MethodCallPoolableObjectFactory factory, final List expectedMethods) throws Exception {
+    private static void reset(final ObjectPool<Object> pool, final MethodCallPoolableObjectFactory factory, final List<MethodCall> expectedMethods) throws Exception {
         pool.clear();
         clear(factory, expectedMethods);
         factory.reset();
     }
 
-    private static void clear(final MethodCallPoolableObjectFactory factory, final List expectedMethods) {
+    private static void clear(final MethodCallPoolableObjectFactory factory, final List<MethodCall> expectedMethods) {
         factory.getMethodCalls().clear();
         expectedMethods.clear();
     }

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPoolFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPoolFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPoolFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestObjectPoolFactory.java Mon Oct 11 21:39:15 2010
@@ -33,28 +33,28 @@ public abstract class TestObjectPoolFact
     /**
      * @throws UnsupportedOperationException when this is unsupported by this PoolableObjectFactory type.
      */
-    protected ObjectPoolFactory makeFactory() throws UnsupportedOperationException {
+    protected ObjectPoolFactory<Object> makeFactory() throws UnsupportedOperationException {
         return makeFactory(new MethodCallPoolableObjectFactory());
     }
 
     /**
      * @throws UnsupportedOperationException when this is unsupported by this PoolableObjectFactory type.
      */
-    protected abstract ObjectPoolFactory makeFactory(PoolableObjectFactory objectFactory) throws UnsupportedOperationException;
+    protected abstract ObjectPoolFactory<Object> makeFactory(PoolableObjectFactory<Object> objectFactory) throws UnsupportedOperationException;
 
     public void testCreatePool() throws Exception {
-        final ObjectPoolFactory factory;
+        final ObjectPoolFactory<Object> factory;
         try {
             factory = makeFactory();
         } catch (UnsupportedOperationException uoe) {
             return;
         }
-        final ObjectPool pool = factory.createPool();
+        final ObjectPool<Object> pool = factory.createPool();
         pool.close();
     }
 
     public void testToString() {
-        final ObjectPoolFactory factory;
+        final ObjectPoolFactory<Object> factory;
         try {
             factory = makeFactory();
         } catch (UnsupportedOperationException uoe) {

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestPoolUtils.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestPoolUtils.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestPoolUtils.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/TestPoolUtils.java Mon Oct 11 21:39:15 2010
@@ -59,7 +59,7 @@ public class TestPoolUtils extends TestC
 
     public void testAdaptKeyedPoolableObjectFactory() throws Exception {
         try {
-            PoolUtils.adapt((KeyedPoolableObjectFactory)null);
+            PoolUtils.adapt((KeyedPoolableObjectFactory<Object,Object>)null);
             fail("PoolUtils.adapt(KeyedPoolableObjectFactory) must not allow null factory.");
         } catch (IllegalArgumentException iae) {
             // expected
@@ -68,47 +68,47 @@ public class TestPoolUtils extends TestC
 
     public void testAdaptKeyedPoolableObjectFactoryKey() throws Exception {
         try {
-            PoolUtils.adapt((KeyedPoolableObjectFactory)null, new Object());
+            PoolUtils.adapt((KeyedPoolableObjectFactory<Object,Object>)null, new Object());
             fail("PoolUtils.adapt(KeyedPoolableObjectFactory, key) must not allow null factory.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
         try {
-            PoolUtils.adapt((KeyedPoolableObjectFactory)createProxy(KeyedPoolableObjectFactory.class, (List)null), null);
+            PoolUtils.adapt((KeyedPoolableObjectFactory<Object,Object>)createProxy(KeyedPoolableObjectFactory.class, (List<String>)null), null);
             fail("PoolUtils.adapt(KeyedPoolableObjectFactory, key) must not allow null key.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final KeyedPoolableObjectFactory kpof =
-                (KeyedPoolableObjectFactory)createProxy(KeyedPoolableObjectFactory.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final KeyedPoolableObjectFactory<Object,Object> kpof =
+                (KeyedPoolableObjectFactory<Object,Object>)createProxy(KeyedPoolableObjectFactory.class, calledMethods);
 
-        final PoolableObjectFactory pof = PoolUtils.adapt(kpof);
-        final List expectedMethods = invokeEveryMethod(pof);
+        final PoolableObjectFactory<Object> pof = PoolUtils.adapt(kpof);
+        final List<String> expectedMethods = invokeEveryMethod(pof);
         assertEquals(expectedMethods, calledMethods);
     }
 
     public void testAdaptPoolableObjectFactory() throws Exception {
         try {
-            PoolUtils.adapt((PoolableObjectFactory)null);
+            PoolUtils.adapt((PoolableObjectFactory<Object>)null);
             fail("PoolUtils.adapt(PoolableObjectFactory) must not allow null factory.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final PoolableObjectFactory pof =
-                (PoolableObjectFactory)createProxy(PoolableObjectFactory.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final PoolableObjectFactory<Object> pof =
+                (PoolableObjectFactory<Object>)createProxy(PoolableObjectFactory.class, calledMethods);
 
-        final KeyedPoolableObjectFactory kpof = PoolUtils.adapt(pof);
-        final List expectedMethods = invokeEveryMethod(kpof);
+        final KeyedPoolableObjectFactory<Object,Object> kpof = PoolUtils.adapt(pof);
+        final List<String> expectedMethods = invokeEveryMethod(kpof);
         assertEquals(expectedMethods, calledMethods);
     }
 
     public void testAdaptKeyedObjectPool() throws Exception {
         try {
-            PoolUtils.adapt((KeyedObjectPool)null);
+            PoolUtils.adapt((KeyedObjectPool<Object,Object>)null);
             fail("PoolUtils.adapt(KeyedObjectPool) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
@@ -117,64 +117,64 @@ public class TestPoolUtils extends TestC
 
     public void testAdaptKeyedObjectPoolKey() throws Exception {
         try {
-            PoolUtils.adapt((KeyedObjectPool)null, new Object());
+            PoolUtils.adapt((KeyedObjectPool<Object,Object>)null, new Object());
             fail("PoolUtils.adapt(KeyedObjectPool, key) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
         try {
-            PoolUtils.adapt((KeyedObjectPool)createProxy(KeyedObjectPool.class, (List)null), null);
+            PoolUtils.adapt((KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, (List<String>)null), null);
             fail("PoolUtils.adapt(KeyedObjectPool, key) must not allow a null key.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final KeyedObjectPool kop = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final KeyedObjectPool<Object,Object> kop = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, calledMethods);
 
-        final ObjectPool op = PoolUtils.adapt(kop, new Object());
-        final List expectedMethods = invokeEveryMethod(op);
+        final ObjectPool<Object> op = PoolUtils.adapt(kop, new Object());
+        final List<String> expectedMethods = invokeEveryMethod(op);
         assertEquals(expectedMethods, calledMethods);
     }
 
     public void testAdaptObjectPool() throws Exception {
         try {
-            PoolUtils.adapt((ObjectPool)null);
+            PoolUtils.adapt((ObjectPool<Object>)null);
             fail("PoolUtils.adapt(ObjectPool) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final ObjectPool op = (ObjectPool)createProxy(ObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final ObjectPool<Object> op = (ObjectPool<Object>)createProxy(ObjectPool.class, calledMethods);
 
-        final KeyedObjectPool kop = PoolUtils.adapt(op);
-        final List expectedMethods = invokeEveryMethod(kop);
+        final KeyedObjectPool<Object,Object> kop = PoolUtils.adapt(op);
+        final List<String> expectedMethods = invokeEveryMethod(kop);
         assertEquals(expectedMethods, calledMethods);
     }
 
     public void testCheckedPoolObjectPool() throws Exception {
         try {
-            PoolUtils.checkedPool((ObjectPool)null, Object.class);
+            PoolUtils.checkedPool((ObjectPool<Object>)null, Object.class);
             fail("PoolUtils.checkedPool(ObjectPool, Class) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
         try {
-            PoolUtils.checkedPool((ObjectPool)createProxy(ObjectPool.class, (List)null), null);
+            PoolUtils.checkedPool((ObjectPool<Object>)createProxy(ObjectPool.class, (List<String>)null), null);
             fail("PoolUtils.checkedPool(ObjectPool, Class) must not allow a null type.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        ObjectPool op = (ObjectPool)createProxy(ObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        ObjectPool<Object> op = (ObjectPool<Object>)createProxy(ObjectPool.class, calledMethods);
 
-        ObjectPool cop = PoolUtils.checkedPool(op, Object.class);
-        final List expectedMethods = invokeEveryMethod(cop);
+        ObjectPool<Object> cop = PoolUtils.checkedPool(op, Object.class);
+        final List<String> expectedMethods = invokeEveryMethod(cop);
         assertEquals(expectedMethods, calledMethods);
 
-        op = new BaseObjectPool() {
+        op = new BaseObjectPool<Object>() {
             public Object borrowObject() throws Exception {
                 return new Integer(0);
             }
@@ -205,27 +205,27 @@ public class TestPoolUtils extends TestC
 
     public void testCheckedPoolKeyedObjectPool() throws Exception {
         try {
-            PoolUtils.checkedPool((KeyedObjectPool)null, Object.class);
+            PoolUtils.checkedPool((KeyedObjectPool<Object,Object>)null, Object.class);
             fail("PoolUtils.checkedPool(KeyedObjectPool, Class) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
         try {
-            PoolUtils.checkedPool((KeyedObjectPool)createProxy(KeyedObjectPool.class, (List)null), null);
+            PoolUtils.checkedPool((KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, (List)null), null);
             fail("PoolUtils.checkedPool(KeyedObjectPool, Class) must not allow a null type.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        KeyedObjectPool op = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        KeyedObjectPool<Object,Object> op = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, calledMethods);
 
-        KeyedObjectPool cop = PoolUtils.checkedPool(op, Object.class);
-        final List expectedMethods = invokeEveryMethod(cop);
+        KeyedObjectPool<Object,Object> cop = PoolUtils.checkedPool(op, Object.class);
+        final List<String> expectedMethods = invokeEveryMethod(cop);
         assertEquals(expectedMethods, calledMethods);
 
 
-        op = new BaseKeyedObjectPool() {
+        op = new BaseKeyedObjectPool<Object,Object>() {
             public Object borrowObject(Object key) {
                 return new Integer(0);
             }
@@ -264,24 +264,24 @@ public class TestPoolUtils extends TestC
             // expected
         }
         try {
-            final ObjectPool pool = (ObjectPool)createProxy(ObjectPool.class, (List)null);
+            final ObjectPool<Object> pool = (ObjectPool<Object>)createProxy(ObjectPool.class, (List<String>)null);
             PoolUtils.checkMinIdle(pool, -1, 1);
             fail("PoolUtils.checkMinIdle(ObjectPool,,) must not accept negative min idle values.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
+        final List<String> calledMethods = new ArrayList<String>();
 
         // Test that the minIdle check doesn't add too many idle objects
-        final PoolableObjectFactory pof = (PoolableObjectFactory)createProxy(PoolableObjectFactory.class, calledMethods);
-        final ObjectPool op = new GenericObjectPool(pof);
+        final PoolableObjectFactory<Object> pof = (PoolableObjectFactory<Object>)createProxy(PoolableObjectFactory.class, calledMethods);
+        final ObjectPool<Object> op = new GenericObjectPool<Object>(pof);
         PoolUtils.checkMinIdle(op, 2, 100);
         Thread.sleep(400);
         assertEquals(2, op.getNumIdle());
         op.close();
         int makeObjectCount = 0;
-        final Iterator iter = calledMethods.iterator();
+        final Iterator<String> iter = calledMethods.iterator();
         while (iter.hasNext()) {
             final String methodName = (String)iter.next();
             if ("makeObject".equals(methodName)) {
@@ -297,14 +297,14 @@ public class TestPoolUtils extends TestC
             afe = null;
             try {
                 calledMethods.clear();
-                final ObjectPool pool = (ObjectPool)createProxy(ObjectPool.class, calledMethods);
+                final ObjectPool<Object> pool = (ObjectPool<Object>)createProxy(ObjectPool.class, calledMethods);
                 final TimerTask task = PoolUtils.checkMinIdle(pool, 1, CHECK_PERIOD); // checks minIdle immediately
 
                 Thread.sleep(CHECK_SLEEP_PERIOD); // will check CHECK_COUNT more times.
                 task.cancel();
                 task.toString();
 
-                final List expectedMethods = new ArrayList();
+                final List<String> expectedMethods = new ArrayList<String>();
                 for (int i=0; i < CHECK_COUNT; i++) {
                     expectedMethods.add("getNumIdle");
                     expectedMethods.add("addObject");
@@ -328,35 +328,35 @@ public class TestPoolUtils extends TestC
             // expected
         }
         try {
-            final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, (List)null);
+            final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, (List)null);
             PoolUtils.checkMinIdle(pool, (Object)null, 1, 1);
             fail("PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not accept null keys.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
         try {
-            final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, (List)null);
+            final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, (List)null);
             PoolUtils.checkMinIdle(pool, new Object(), -1, 1);
             fail("PoolUtils.checkMinIdle(KeyedObjectPool,Object,int,long) must not accept negative min idle values.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
+        final List<String> calledMethods = new ArrayList<String>();
         final Object key = new Object();
 
         // Test that the minIdle check doesn't add too many idle objects
-        final KeyedPoolableObjectFactory kpof = (KeyedPoolableObjectFactory)createProxy(KeyedPoolableObjectFactory.class, calledMethods);
-        final KeyedObjectPool kop = new GenericKeyedObjectPool(kpof);
+        final KeyedPoolableObjectFactory<Object,Object> kpof = (KeyedPoolableObjectFactory<Object,Object>)createProxy(KeyedPoolableObjectFactory.class, calledMethods);
+        final KeyedObjectPool<Object,Object> kop = new GenericKeyedObjectPool<Object,Object>(kpof);
         PoolUtils.checkMinIdle(kop, key, 2, 100);
         Thread.sleep(400);
         assertEquals(2, kop.getNumIdle(key));
         assertEquals(2, kop.getNumIdle());
         kop.close();
         int makeObjectCount = 0;
-        final Iterator iter = calledMethods.iterator();
+        final Iterator<String> iter = calledMethods.iterator();
         while (iter.hasNext()) {
-            final String methodName = (String)iter.next();
+            final String methodName = iter.next();
             if ("makeObject".equals(methodName)) {
                 makeObjectCount++;
             }
@@ -370,14 +370,14 @@ public class TestPoolUtils extends TestC
             afe = null;
             try {
                 calledMethods.clear();
-                final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
+                final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, calledMethods);
                 final TimerTask task = PoolUtils.checkMinIdle(pool, key, 1, CHECK_PERIOD); // checks minIdle immediately
 
                 Thread.sleep(CHECK_SLEEP_PERIOD); // will check CHECK_COUNT more times.
                 task.cancel();
                 task.toString();
 
-                final List expectedMethods = new ArrayList();
+                final List<String> expectedMethods = new ArrayList<String>();
                 for (int i=0; i < CHECK_COUNT; i++) {
                     expectedMethods.add("getNumIdle");
                     expectedMethods.add("addObject");
@@ -395,8 +395,8 @@ public class TestPoolUtils extends TestC
 
     public void testCheckMinIdleKeyedObjectPoolKeys() throws Exception {
         try {
-            final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, (List)null);
-            PoolUtils.checkMinIdle(pool, null, 1, 1);
+            final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, (List)null);
+            PoolUtils.checkMinIdle(pool, (Object)null, 1, 1);
             fail("PoolUtils.checkMinIdle(KeyedObjectPool,Collection,int,long) must not accept null keys.");
         } catch (IllegalArgumentException iae) {
             // expected
@@ -408,21 +408,21 @@ public class TestPoolUtils extends TestC
         do {
             afe = null;
             try {
-                final List calledMethods = new ArrayList();
-                final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
-                final Collection keys = new ArrayList(2);
+                final List<String> calledMethods = new ArrayList<String>();
+                final KeyedObjectPool<String,Object> pool = (KeyedObjectPool<String,Object>)createProxy(KeyedObjectPool.class, calledMethods);
+                final Collection<String> keys = new ArrayList<String>(2);
                 keys.add("one");
                 keys.add("two");
-                final Map tasks = PoolUtils.checkMinIdle(pool, keys, 1, CHECK_PERIOD); // checks minIdle immediately
+                final Map<String,TimerTask> tasks = PoolUtils.checkMinIdle(pool, keys, 1, CHECK_PERIOD); // checks minIdle immediately
 
                 Thread.sleep(CHECK_SLEEP_PERIOD); // will check CHECK_COUNT more times.
-                final Iterator iter = tasks.values().iterator();
+                final Iterator<TimerTask> iter = tasks.values().iterator();
                 while (iter.hasNext()) {
                     final TimerTask task = (TimerTask)iter.next();
                     task.cancel();
                 }
 
-                final List expectedMethods = new ArrayList();
+                final List<String> expectedMethods = new ArrayList<String>();
                 for (int i=0; i < CHECK_COUNT * keys.size(); i++) {
                     expectedMethods.add("getNumIdle");
                     expectedMethods.add("addObject");
@@ -445,11 +445,11 @@ public class TestPoolUtils extends TestC
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final ObjectPool pool = (ObjectPool)createProxy(ObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final ObjectPool<Object> pool = (ObjectPool<Object>)createProxy(ObjectPool.class, calledMethods);
 
         PoolUtils.prefill(pool, 0);
-        final List expectedMethods = new ArrayList();
+        final List<String> expectedMethods = new ArrayList<String>();
         assertEquals(expectedMethods, calledMethods);
 
         calledMethods.clear();
@@ -468,18 +468,18 @@ public class TestPoolUtils extends TestC
             // expected
         }
         try {
-            final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, (List)null);
+            final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, (List)null);
             PoolUtils.prefill(pool, (Object)null, 1);
             fail("PoolUtils.prefill(KeyedObjectPool,Object,int) must not accept null key.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, calledMethods);
 
         PoolUtils.prefill(pool, new Object(), 0);
-        final List expectedMethods = new ArrayList();
+        final List<String> expectedMethods = new ArrayList<String>();
         assertEquals(expectedMethods, calledMethods);
 
         calledMethods.clear();
@@ -492,19 +492,19 @@ public class TestPoolUtils extends TestC
 
     public void testPrefillKeyedObjectPoolCollection() throws Exception {
         try {
-            final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, (List)null);
+            final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, (List)null);
             PoolUtils.prefill(pool, null, 1);
             fail("PoolUtils.prefill(KeyedObjectPool,Collection,int) must not accept null keys.");
         } catch (IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final KeyedObjectPool pool = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final KeyedObjectPool<Object,Object> pool = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, calledMethods);
 
-        final Set keys = new HashSet();
+        final Set<Object> keys = new HashSet<Object>();
         PoolUtils.prefill(pool, keys, 0);
-        final List expectedMethods = new ArrayList();
+        final List<String> expectedMethods = new ArrayList<String>();
         assertEquals(expectedMethods, calledMethods);
 
         calledMethods.clear();
@@ -520,17 +520,17 @@ public class TestPoolUtils extends TestC
 
     public void testSynchronizedPoolObjectPool() throws Exception {
         try {
-            PoolUtils.synchronizedPool((ObjectPool)null);
+            PoolUtils.synchronizedPool((ObjectPool<Object>)null);
             fail("PoolUtils.synchronizedPool(ObjectPool) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final ObjectPool op = (ObjectPool)createProxy(ObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final ObjectPool<Object> op = (ObjectPool<Object>)createProxy(ObjectPool.class, calledMethods);
 
-        final ObjectPool sop = PoolUtils.synchronizedPool(op);
-        final List expectedMethods = invokeEveryMethod(sop);
+        final ObjectPool<Object> sop = PoolUtils.synchronizedPool(op);
+        final List<String> expectedMethods = invokeEveryMethod(sop);
         assertEquals(expectedMethods, calledMethods);
 
         // TODO: Anyone feel motivated to construct a test that verifies proper synchronization?
@@ -538,17 +538,17 @@ public class TestPoolUtils extends TestC
 
     public void testSynchronizedPoolKeyedObjectPool() throws Exception {
         try {
-            PoolUtils.synchronizedPool((KeyedObjectPool)null);
+            PoolUtils.synchronizedPool((KeyedObjectPool<Object,Object>)null);
             fail("PoolUtils.synchronizedPool(KeyedObjectPool) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final KeyedObjectPool kop = (KeyedObjectPool)createProxy(KeyedObjectPool.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final KeyedObjectPool<Object,Object> kop = (KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, calledMethods);
 
-        final KeyedObjectPool skop = PoolUtils.synchronizedPool(kop);
-        final List expectedMethods = invokeEveryMethod(skop);
+        final KeyedObjectPool<Object,Object> skop = PoolUtils.synchronizedPool(kop);
+        final List<String> expectedMethods = invokeEveryMethod(skop);
         assertEquals(expectedMethods, calledMethods);
 
         // TODO: Anyone feel motivated to construct a test that verifies proper synchronization?
@@ -562,12 +562,12 @@ public class TestPoolUtils extends TestC
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final PoolableObjectFactory pof =
-                (PoolableObjectFactory)createProxy(PoolableObjectFactory.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final PoolableObjectFactory<Object> pof =
+                (PoolableObjectFactory<Object>)createProxy(PoolableObjectFactory.class, calledMethods);
 
-        final PoolableObjectFactory spof = PoolUtils.synchronizedPoolableFactory(pof);
-        final List expectedMethods = invokeEveryMethod(spof);
+        final PoolableObjectFactory<Object> spof = PoolUtils.synchronizedPoolableFactory(pof);
+        final List<String> expectedMethods = invokeEveryMethod(spof);
         assertEquals(expectedMethods, calledMethods);
 
         // TODO: Anyone feel motivated to construct a test that verifies proper synchronization?
@@ -575,18 +575,18 @@ public class TestPoolUtils extends TestC
 
     public void testSynchronizedPoolableFactoryKeyedPoolableObjectFactory() throws Exception {
         try {
-            PoolUtils.synchronizedPoolableFactory((KeyedPoolableObjectFactory)null);
+            PoolUtils.synchronizedPoolableFactory((KeyedPoolableObjectFactory<Object,Object>)null);
             fail("PoolUtils.synchronizedPoolableFactory(KeyedPoolableObjectFactory) must not allow a null factory.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
-        final KeyedPoolableObjectFactory kpof =
-                (KeyedPoolableObjectFactory)createProxy(KeyedPoolableObjectFactory.class, calledMethods);
+        final List<String> calledMethods = new ArrayList<String>();
+        final KeyedPoolableObjectFactory<Object,Object> kpof =
+                (KeyedPoolableObjectFactory<Object,Object>)createProxy(KeyedPoolableObjectFactory.class, calledMethods);
 
-        final KeyedPoolableObjectFactory skpof = PoolUtils.synchronizedPoolableFactory(kpof);
-        final List expectedMethods = invokeEveryMethod(skpof);
+        final KeyedPoolableObjectFactory<Object,Object> skpof = PoolUtils.synchronizedPoolableFactory(kpof);
+        final List<String> expectedMethods = invokeEveryMethod(skpof);
         assertEquals(expectedMethods, calledMethods);
 
         // TODO: Anyone feel motivated to construct a test that verifies proper synchronization?
@@ -594,27 +594,27 @@ public class TestPoolUtils extends TestC
 
     public void testErodingPoolObjectPool() throws Exception {
         try {
-            PoolUtils.erodingPool((ObjectPool)null);
+            PoolUtils.erodingPool((ObjectPool<Object>)null);
             fail("PoolUtils.erodingPool(ObjectPool) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((ObjectPool)null, 1f);
+            PoolUtils.erodingPool((ObjectPool<Object>)null, 1f);
             fail("PoolUtils.erodingPool(ObjectPool, float) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((ObjectPool)null, 0);
+            PoolUtils.erodingPool((ObjectPool<Object>)null, 0);
             fail("PoolUtils.erodingPool(ObjectPool, float) must not allow a non-positive factor.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
+        final List<String> calledMethods = new ArrayList<String>();
         final InvocationHandler handler = new MethodCallLogger(calledMethods) {
             public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                 Object o = super.invoke(proxy, method, args);
@@ -628,9 +628,9 @@ public class TestPoolUtils extends TestC
 
         // If the logic behind PoolUtils.erodingPool changes then this will need to be tweaked.
         float factor = 0.01f; // about ~9 seconds until first discard
-        final ObjectPool pool = PoolUtils.erodingPool((ObjectPool)createProxy(ObjectPool.class, handler), factor);
+        final ObjectPool<Object> pool = PoolUtils.erodingPool((ObjectPool<Object>)createProxy(ObjectPool.class, handler), factor);
 
-        final List expectedMethods = new ArrayList();
+        final List<String> expectedMethods = new ArrayList<String>();
         assertEquals(expectedMethods, calledMethods);
 
         Object o = pool.borrowObject();
@@ -670,41 +670,41 @@ public class TestPoolUtils extends TestC
 
     public void testErodingPoolKeyedObjectPool() throws Exception {
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null);
             fail("PoolUtils.erodingPool(KeyedObjectPool) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null, 1f);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null, 1f);
             fail("PoolUtils.erodingPool(KeyedObjectPool, float) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null, 0);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null, 0);
             fail("PoolUtils.erodingPool(ObjectPool, float) must not allow a non-positive factor.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null, 1f, true);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null, 1f, true);
             fail("PoolUtils.erodingPool(KeyedObjectPool, float, boolean) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null, 0, false);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null, 0, false);
             fail("PoolUtils.erodingPool(ObjectPool, float, boolean) must not allow a non-positive factor.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
+        final List<String> calledMethods = new ArrayList<String>();
         final InvocationHandler handler = new MethodCallLogger(calledMethods) {
             public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                 Object o = super.invoke(proxy, method, args);
@@ -718,9 +718,9 @@ public class TestPoolUtils extends TestC
 
         // If the logic behind PoolUtils.erodingPool changes then this will need to be tweaked.
         float factor = 0.01f; // about ~9 seconds until first discard
-        final KeyedObjectPool pool = PoolUtils.erodingPool((KeyedObjectPool)createProxy(KeyedObjectPool.class, handler), factor);
+        final KeyedObjectPool<Object,Object> pool = PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, handler), factor);
 
-        final List expectedMethods = new ArrayList();
+        final List<String> expectedMethods = new ArrayList<String>();
         assertEquals(expectedMethods, calledMethods);
 
         final Object key = "key";
@@ -762,27 +762,27 @@ public class TestPoolUtils extends TestC
     
     public void testErodingPerKeyKeyedObjectPool() throws Exception {
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null, 1, true);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null, 1, true);
             fail("PoolUtils.erodingPool(KeyedObjectPool) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null, 0, true);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null, 0, true);
             fail("PoolUtils.erodingPool(ObjectPool, float) must not allow a non-positive factor.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
         try {
-            PoolUtils.erodingPool((KeyedObjectPool)null, 1f, true);
+            PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)null, 1f, true);
             fail("PoolUtils.erodingPool(KeyedObjectPool, float, boolean) must not allow a null pool.");
         } catch(IllegalArgumentException iae) {
             // expected
         }
 
-        final List calledMethods = new ArrayList();
+        final List<String> calledMethods = new ArrayList<String>();
         final InvocationHandler handler = new MethodCallLogger(calledMethods) {
             public Object invoke(final Object proxy, final Method method, final Object[] args) throws Throwable {
                 Object o = super.invoke(proxy, method, args);
@@ -796,9 +796,9 @@ public class TestPoolUtils extends TestC
 
         // If the logic behind PoolUtils.erodingPool changes then this will need to be tweaked.
         float factor = 0.01f; // about ~9 seconds until first discard
-        final KeyedObjectPool pool = PoolUtils.erodingPool((KeyedObjectPool)createProxy(KeyedObjectPool.class, handler), factor, true);
+        final KeyedObjectPool<Object,Object> pool = PoolUtils.erodingPool((KeyedObjectPool<Object,Object>)createProxy(KeyedObjectPool.class, handler), factor, true);
 
-        final List expectedMethods = new ArrayList();
+        final List<String> expectedMethods = new ArrayList<String>();
         assertEquals(expectedMethods, calledMethods);
 
         final Object key = "key";
@@ -838,7 +838,7 @@ public class TestPoolUtils extends TestC
         assertEquals(expectedMethods, calledMethods);
     }
 
-    private static List invokeEveryMethod(ObjectPool op) throws Exception {
+    private static List<String> invokeEveryMethod(ObjectPool<Object> op) throws Exception {
         op.addObject();
         op.borrowObject();
         op.clear();
@@ -847,10 +847,10 @@ public class TestPoolUtils extends TestC
         op.getNumIdle();
         op.invalidateObject(new Object());
         op.returnObject(new Object());
-        op.setFactory((PoolableObjectFactory)createProxy(PoolableObjectFactory.class, (List)null));
+        op.setFactory((PoolableObjectFactory<Object>)createProxy(PoolableObjectFactory.class, (List)null));
         op.toString();
 
-        final List expectedMethods = Arrays.asList(new String[] {
+        final List<String> expectedMethods = Arrays.asList(new String[] {
                 "addObject", "borrowObject", "clear", "close",
                 "getNumActive", "getNumIdle", "invalidateObject",
                 "returnObject", "setFactory", "toString"
@@ -858,7 +858,7 @@ public class TestPoolUtils extends TestC
         return expectedMethods;
     }
 
-    private static List invokeEveryMethod(KeyedObjectPool kop) throws Exception {
+    private static List<String> invokeEveryMethod(KeyedObjectPool<Object,Object> kop) throws Exception {
         kop.addObject(null);
         kop.borrowObject(null);
         kop.clear();
@@ -870,10 +870,10 @@ public class TestPoolUtils extends TestC
         kop.getNumIdle(null);
         kop.invalidateObject(null, new Object());
         kop.returnObject(null, new Object());
-        kop.setFactory((KeyedPoolableObjectFactory)createProxy(KeyedPoolableObjectFactory.class, (List)null));
+        kop.setFactory((KeyedPoolableObjectFactory<Object,Object>)createProxy(KeyedPoolableObjectFactory.class, (List<String>)null));
         kop.toString();
 
-        final List expectedMethods = Arrays.asList(new String[] {
+        final List<String> expectedMethods = Arrays.asList(new String[] {
                 "addObject", "borrowObject", "clear", "clear", "close",
                 "getNumActive", "getNumActive", "getNumIdle", "getNumIdle", "invalidateObject",
                 "returnObject", "setFactory", "toString"
@@ -881,7 +881,7 @@ public class TestPoolUtils extends TestC
         return expectedMethods;
     }
 
-    private static List invokeEveryMethod(PoolableObjectFactory pof) throws Exception {
+    private static <T> List<String> invokeEveryMethod(PoolableObjectFactory<T> pof) throws Exception {
         pof.activateObject(null);
         pof.destroyObject(null);
         pof.makeObject();
@@ -889,14 +889,14 @@ public class TestPoolUtils extends TestC
         pof.validateObject(null);
         pof.toString();
 
-        final List expectedMethods = Arrays.asList(new String[] {
+        final List<String> expectedMethods = Arrays.asList(new String[] {
                 "activateObject", "destroyObject", "makeObject",
                 "passivateObject", "validateObject", "toString",
         });
         return expectedMethods;
     }
 
-    private static List invokeEveryMethod(KeyedPoolableObjectFactory kpof) throws Exception {
+    private static <K,V> List<String> invokeEveryMethod(KeyedPoolableObjectFactory<K,V> kpof) throws Exception {
         kpof.activateObject(null, null);
         kpof.destroyObject(null, null);
         kpof.makeObject(null);
@@ -904,25 +904,25 @@ public class TestPoolUtils extends TestC
         kpof.validateObject(null, null);
         kpof.toString();
 
-        final List expectedMethods = Arrays.asList(new String[] {
+        final List<String> expectedMethods = Arrays.asList(new String[] {
                 "activateObject", "destroyObject", "makeObject",
                 "passivateObject", "validateObject", "toString",
         });
         return expectedMethods;
     }
 
-    private static Object createProxy(final Class clazz, final List logger) {
+    private static <T> T createProxy(final Class<T> clazz, final List<String> logger) {
         return createProxy(clazz, new MethodCallLogger(logger));
     }
 
-    private static Object createProxy(final Class clazz, final InvocationHandler handler) {
-        return Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, handler);
+    private static <T> T createProxy(final Class<T> clazz, final InvocationHandler handler) {
+        return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, handler);
     }
 
     private static class MethodCallLogger implements InvocationHandler {
-        private final List calledMethods;
+        private final List<String> calledMethods;
 
-        MethodCallLogger(final List calledMethods) {
+        MethodCallLogger(final List<String> calledMethods) {
             this.calledMethods = calledMethods;
         }
 

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTracker.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTracker.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTracker.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTracker.java Mon Oct 11 21:39:15 2010
@@ -21,13 +21,13 @@ package org.apache.commons.pool;
  * validated, activated, passivated.
  *
  */
-public class VisitTracker {
+public class VisitTracker<K> {
     private int validateCount = 0;
     private int activateCount = 0;
     private int passivateCount = 0;
     private boolean destroyed = false;
     private int id = 0;
-    private Object key = null;
+    private K key = null;
     
     public VisitTracker() {
         super();
@@ -40,7 +40,7 @@ public class VisitTracker {
         reset();
     }
     
-    public VisitTracker(int id, Object key) {
+    public VisitTracker(int id, K key) {
         super();
         this.id = id;
         this.key = key;
@@ -90,7 +90,7 @@ public class VisitTracker {
     public int getId() {
         return id;
     }
-    public Object getKey() {
+    public K getKey() {
         return key;
     }
     public String toString() {

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTrackerFactory.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTrackerFactory.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTrackerFactory.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/VisitTrackerFactory.java Mon Oct 11 21:39:15 2010
@@ -22,41 +22,41 @@ package org.apache.commons.pool;
  * test Evictor runs.
  *
  */
-public class VisitTrackerFactory implements PoolableObjectFactory, 
-    KeyedPoolableObjectFactory {
+public class VisitTrackerFactory<K> implements PoolableObjectFactory<VisitTracker<K>>, 
+    KeyedPoolableObjectFactory<K,VisitTracker<K>> {
     private int nextId = 0;
     public VisitTrackerFactory() {
         super();
     }
-    public Object makeObject() {
-        return new VisitTracker(nextId++);
+    public VisitTracker<K> makeObject() {
+        return new VisitTracker<K>(nextId++);
     }
-    public Object makeObject(Object key) {
-        return new VisitTracker(nextId++, key);
+    public VisitTracker<K> makeObject(K key) {
+        return new VisitTracker<K>(nextId++, key);
     }
-    public void destroyObject(Object obj) {
-        ((VisitTracker) obj).destroy();
+    public void destroyObject(VisitTracker<K> obj) {
+        obj.destroy();
     }
-    public void destroyObject(Object key, Object obj) {
-        ((VisitTracker) obj).destroy();
+    public void destroyObject(K key, VisitTracker<K> obj) {
+        obj.destroy();
     }
-    public boolean validateObject(Object obj) {
-        return ((VisitTracker) obj).validate();
+    public boolean validateObject(VisitTracker<K> obj) {
+        return obj.validate();
     }
-    public boolean validateObject(Object key, Object obj) {
-        return ((VisitTracker) obj).validate();
+    public boolean validateObject(K key, VisitTracker<K> obj) {
+        return obj.validate();
     }
-    public void activateObject(Object obj) throws Exception {
-        ((VisitTracker) obj).activate();
+    public void activateObject(VisitTracker<K> obj) throws Exception {
+        obj.activate();
     }
-    public void activateObject(Object key, Object obj) throws Exception {
-        ((VisitTracker) obj).activate();
+    public void activateObject(K key, VisitTracker<K> obj) throws Exception {
+        obj.activate();
     }
-    public void passivateObject(Object obj) throws Exception {
-        ((VisitTracker) obj).passivate();
+    public void passivateObject(VisitTracker<K> obj) throws Exception {
+        obj.passivate();
     }
-    public void passivateObject(Object key, Object obj) throws Exception {
-        ((VisitTracker) obj).passivate();
+    public void passivateObject(K key, VisitTracker<K> obj) throws Exception {
+        obj.passivate();
     }
     public void resetId() {
         nextId = 0;

Modified: commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java
URL: http://svn.apache.org/viewvc/commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java?rev=1021517&r1=1021516&r2=1021517&view=diff
==============================================================================
--- commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java (original)
+++ commons/proper/pool/trunk/src/test/org/apache/commons/pool/impl/TestGenericKeyedObjectPool.java Mon Oct 11 21:39:15 2010
@@ -38,13 +38,13 @@ public class TestGenericKeyedObjectPool 
         super(testName);
     }
 
-    protected KeyedObjectPool makeEmptyPool(int mincapacity) {
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(
-            new KeyedPoolableObjectFactory()  {
-                HashMap map = new HashMap();
+    protected KeyedObjectPool<Object,Object> makeEmptyPool(int mincapacity) {
+        GenericKeyedObjectPool <Object,Object>pool = new GenericKeyedObjectPool<Object,Object>(
+            new KeyedPoolableObjectFactory<Object,Object>()  {
+                HashMap<Object,Integer> map = new HashMap<Object,Integer>();
                 public Object makeObject(Object key) {
                     int counter = 0;
-                    Integer Counter = (Integer)(map.get(key));
+                    Integer Counter = map.get(key);
                     if(null != Counter) {
                         counter = Counter.intValue();
                     }
@@ -62,8 +62,8 @@ public class TestGenericKeyedObjectPool 
         return pool;
     }
 
-    protected KeyedObjectPool makeEmptyPool(KeyedPoolableObjectFactory factory) {
-        return new GenericKeyedObjectPool(factory);
+    protected KeyedObjectPool<Object,Object> makeEmptyPool(KeyedPoolableObjectFactory<Object,Object> factory) {
+        return new GenericKeyedObjectPool<Object,Object>(factory);
     }
 
     protected Object getNthObject(Object key, int n) {
@@ -74,14 +74,14 @@ public class TestGenericKeyedObjectPool 
         return String.valueOf(n);
     }
 
-    private GenericKeyedObjectPool pool = null;
+    private GenericKeyedObjectPool<String,String> pool = null;
     private final Integer zero = new Integer(0);
     private final Integer one = new Integer(1);
     private final Integer two = new Integer(2);
 
     public void setUp() throws Exception {
         super.setUp();
-        pool = new GenericKeyedObjectPool(new SimpleFactory());
+        pool = new GenericKeyedObjectPool<String,String>(new SimpleFactory<String>());
     }
 
     public void tearDown() throws Exception {
@@ -94,7 +94,7 @@ public class TestGenericKeyedObjectPool 
     public void testNegativeMaxActive() throws Exception {
         pool.setMaxActive(-1);
         pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
-        Object obj = pool.borrowObject("");
+        String obj = pool.borrowObject("");
         assertEquals("0",obj);
         pool.returnObject("",obj);
     }
@@ -107,8 +107,8 @@ public class TestGenericKeyedObjectPool 
         assertEquals(0,pool.getNumActive("B"));
         assertEquals(0,pool.getNumIdle("B"));
 
-        Object objA0 = pool.borrowObject("A");
-        Object objB0 = pool.borrowObject("B");
+        String objA0 = pool.borrowObject("A");
+        String objB0 = pool.borrowObject("B");
 
         assertEquals(2,pool.getNumActive());
         assertEquals(0,pool.getNumIdle());
@@ -117,8 +117,8 @@ public class TestGenericKeyedObjectPool 
         assertEquals(1,pool.getNumActive("B"));
         assertEquals(0,pool.getNumIdle("B"));
 
-        Object objA1 = pool.borrowObject("A");
-        Object objB1 = pool.borrowObject("B");
+        String objA1 = pool.borrowObject("A");
+        String objB1 = pool.borrowObject("B");
 
         assertEquals(4,pool.getNumActive());
         assertEquals(0,pool.getNumIdle());
@@ -151,7 +151,7 @@ public class TestGenericKeyedObjectPool 
     public void testMaxIdle() throws Exception {
         pool.setMaxActive(100);
         pool.setMaxIdle(8);
-        Object[] active = new Object[100];
+        String[] active = new String[100];
         for(int i=0;i<100;i++) {
             active[i] = pool.borrowObject("");
         }
@@ -223,11 +223,11 @@ public class TestGenericKeyedObjectPool 
         pool.setMaxTotal(3);
         pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_FAIL);
 
-        Object o1 = pool.borrowObject("a");
+        String o1 = pool.borrowObject("a");
         assertNotNull(o1);
-        Object o2 = pool.borrowObject("a");
+        String o2 = pool.borrowObject("a");
         assertNotNull(o2);
-        Object o3 = pool.borrowObject("b");
+        String o3 = pool.borrowObject("b");
         assertNotNull(o3);
         try {
             pool.borrowObject("c");
@@ -276,22 +276,22 @@ public class TestGenericKeyedObjectPool 
         pool.setMaxTotal(3);
 //        pool.setWhenExhaustedAction(GenericKeyedObjectPool.WHEN_EXHAUSTED_GROW);
 
-        Object o1 = pool.borrowObject("a");
+        String o1 = pool.borrowObject("a");
         assertNotNull(o1);
         pool.returnObject("a", o1);
         Thread.sleep(25);
 
-        Object o2 = pool.borrowObject("b");
+        String o2 = pool.borrowObject("b");
         assertNotNull(o2);
         pool.returnObject("b", o2);
         Thread.sleep(25);
 
-        Object o3 = pool.borrowObject("c");
+        String o3 = pool.borrowObject("c");
         assertNotNull(o3);
         pool.returnObject("c", o3);
         Thread.sleep(25);
 
-        Object o4 = pool.borrowObject("a");
+        String o4 = pool.borrowObject("a");
         assertNotNull(o4);
         pool.returnObject("a", o4);
         Thread.sleep(25);
@@ -299,21 +299,21 @@ public class TestGenericKeyedObjectPool 
         assertSame(o1, o4);
 
         // this should cause b to be bumped out of the pool
-        Object o5 = pool.borrowObject("d");
+        String o5 = pool.borrowObject("d");
         assertNotNull(o5);
         pool.returnObject("d", o5);
         Thread.sleep(25);
 
         // now re-request b, we should get a different object because it should
         // have been expelled from pool (was oldest because a was requested after b)
-        Object o6 = pool.borrowObject("b");
+        String o6 = pool.borrowObject("b");
         assertNotNull(o6);
         pool.returnObject("b", o6);
 
         assertNotSame(o1, o6);
 
         // second a is still in there
-        Object o7 = pool.borrowObject("a");
+        String o7 = pool.borrowObject("a");
         assertNotNull(o7);
         pool.returnObject("a", o7);
 
@@ -321,9 +321,9 @@ public class TestGenericKeyedObjectPool 
     }
 
     public void testSettersAndGetters() throws Exception {
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool();
+        GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>();
         {
-            pool.setFactory(new SimpleFactory());
+            pool.setFactory(new SimpleFactory<String>());
         }
         {
             pool.setMaxActive(123);
@@ -384,7 +384,7 @@ public class TestGenericKeyedObjectPool 
         pool.setMinEvictableIdleTimeMillis(250L);
         pool.setTimeBetweenEvictionRunsMillis(500L);
 
-        Object[] active = new Object[500];
+        String[] active = new String[500];
         for(int i=0;i<500;i++) {
             active[i] = pool.borrowObject("");
         }
@@ -433,8 +433,8 @@ public class TestGenericKeyedObjectPool 
         pool.setMinEvictableIdleTimeMillis(500L);
         pool.setTimeBetweenEvictionRunsMillis(500L);
 
-        Object[] active = new Object[500];
-        Object[] active2 = new Object[500];
+        String[] active = new String[500];
+        String[] active2 = new String[500];
         for(int i=0;i<500;i++) {
             active[i] = pool.borrowObject("");
             active2[i] = pool.borrowObject("2");
@@ -508,12 +508,12 @@ public class TestGenericKeyedObjectPool 
      */
     public void testMaxTotalInvariant() throws Exception {
         int maxTotal = 15;
-        SimpleFactory factory = new SimpleFactory();
+        SimpleFactory<String> factory = new SimpleFactory<String>();
         factory.setEvenValid(false);     // Every other validation fails
         factory.setDestroyLatency(100);  // Destroy takes 100 ms
         factory.setMaxActive(maxTotal);  // (makes - destroys) bound
         factory.setValidationEnabled(true);
-        pool = new GenericKeyedObjectPool(factory);
+        pool = new GenericKeyedObjectPool<String,String>(factory);
         pool.setMaxTotal(maxTotal);
         pool.setMaxIdle(-1);
         pool.setTestOnReturn(true);
@@ -539,7 +539,7 @@ public class TestGenericKeyedObjectPool 
         try { Thread.sleep(150L); } catch(InterruptedException e) { }
         assertTrue("Should be 5 idle, found " + pool.getNumIdle(),pool.getNumIdle() == 5);
 
-        Object[] active = new Object[5];
+        String[] active = new String[5];
         active[0] = pool.borrowObject(key);
 
         try { Thread.sleep(150L); } catch(InterruptedException e) { }
@@ -578,7 +578,7 @@ public class TestGenericKeyedObjectPool 
         try { Thread.sleep(150L); } catch(InterruptedException e) { }
         assertTrue("Should be 5 idle, found " + pool.getNumIdle(),pool.getNumIdle() == 5);
 
-        Object[] active = new Object[10];
+        String[] active = new String[10];
 
         try { Thread.sleep(150L); } catch(InterruptedException e) { }
         assertTrue("Should be 5 idle, found " + pool.getNumIdle(),pool.getNumIdle() == 5);
@@ -658,7 +658,7 @@ public class TestGenericKeyedObjectPool 
 
     public void testFIFO() throws Exception {
         pool.setLifo(false);
-        final Object key = "key";
+        final String key = "key";
         pool.addObject(key); // "key0"
         pool.addObject(key); // "key1"
         pool.addObject(key); // "key2"
@@ -673,7 +673,7 @@ public class TestGenericKeyedObjectPool 
     
     public void testLIFO() throws Exception {
         pool.setLifo(true);
-        final Object key = "key";
+        final String key = "key";
         pool.addObject(key); // "key0"
         pool.addObject(key); // "key1"
         pool.addObject(key); // "key2"
@@ -698,8 +698,8 @@ public class TestGenericKeyedObjectPool 
     }
     
     private void checkEvictionOrder(boolean lifo) throws Exception {
-        SimpleFactory factory = new SimpleFactory();
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
+        SimpleFactory<Integer> factory = new SimpleFactory<Integer>();
+        GenericKeyedObjectPool<Integer,String> pool = new GenericKeyedObjectPool<Integer,String>(factory);
         pool.setNumTestsPerEvictionRun(2);
         pool.setMinEvictableIdleTimeMillis(100);
         pool.setLifo(lifo);
@@ -808,8 +808,8 @@ public class TestGenericKeyedObjectPool 
     }
     
     private void checkEvictorVisiting(boolean lifo) throws Exception {
-        VisitTrackerFactory factory = new VisitTrackerFactory();
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
+        VisitTrackerFactory<Integer> factory = new VisitTrackerFactory<Integer>();
+        GenericKeyedObjectPool<Integer,VisitTracker<Integer>> pool = new GenericKeyedObjectPool<Integer,VisitTracker<Integer>>(factory);
         pool.setNumTestsPerEvictionRun(2);
         pool.setMinEvictableIdleTimeMillis(-1);
         pool.setTestWhileIdle(true);
@@ -824,7 +824,7 @@ public class TestGenericKeyedObjectPool 
             }
         }
         pool.evict(); // Visit oldest 2 - 00 and 01
-        Object obj = pool.borrowObject(zero);
+        VisitTracker<Integer> obj = pool.borrowObject(zero);
         pool.returnObject(zero, obj);
         obj = pool.borrowObject(zero);
         pool.returnObject(zero, obj);
@@ -833,7 +833,7 @@ public class TestGenericKeyedObjectPool 
         //  LIFO, 7 out, then in, then out, then in - 7,6,5,4,3,2,1,0
         pool.evict();  // Should visit 02 and 03 in either case
         for (int i = 0; i < 8; i++) {
-            VisitTracker tracker = (VisitTracker) pool.borrowObject(zero);    
+            VisitTracker<Integer> tracker = pool.borrowObject(zero);    
             if (tracker.getId() >= 4) {
                 assertEquals("Unexpected instance visited " + tracker.getId(),
                         0, tracker.getValidateCount());
@@ -873,7 +873,7 @@ public class TestGenericKeyedObjectPool 
         // LIFO - 27, skip, 10
         // FIFO - 24, 25, 26
         for (int i = 0; i < 8; i++) {
-            VisitTracker tracker = (VisitTracker) pool.borrowObject(one);    
+            VisitTracker<Integer> tracker = pool.borrowObject(one);    
             if ((lifo && tracker.getId() > 0) || 
                     (!lifo && tracker.getId() > 2)) {
                 assertEquals("Instance " +  tracker.getId() + 
@@ -925,10 +925,10 @@ public class TestGenericKeyedObjectPool 
                 
                 // Look at elements and make sure they are visited cycleCount
                 // or cycleCount + 1 times
-                VisitTracker tracker = null;
+                VisitTracker<Integer> tracker = null;
                 int visitCount = 0;
                 for (int k = 0; k < zeroLength; k++) {
-                    tracker = (VisitTracker) pool.borrowObject(zero); 
+                    tracker = pool.borrowObject(zero); 
                     visitCount = tracker.getValidateCount();
                     if (visitCount < cycleCount || visitCount > cycleCount + 1){
                         fail(formatSettings("ZERO", "runs", runs, "lifo", lifo, "i", i, "j", j,
@@ -937,7 +937,7 @@ public class TestGenericKeyedObjectPool 
                     }
                 }
                 for (int k = 0; k < oneLength; k++) {
-                    tracker = (VisitTracker) pool.borrowObject(one); 
+                    tracker = pool.borrowObject(one); 
                     visitCount = tracker.getValidateCount();
                     if (visitCount < cycleCount || visitCount > cycleCount + 1){
                         fail(formatSettings("ONE", "runs", runs, "lifo", lifo, "i", i, "j", j,
@@ -947,7 +947,7 @@ public class TestGenericKeyedObjectPool 
                 }
                 int visits[] = new int[twoLength];
                 for (int k = 0; k < twoLength; k++) {
-                    tracker = (VisitTracker) pool.borrowObject(two); 
+                    tracker = pool.borrowObject(two); 
                     visitCount = tracker.getValidateCount();
                     visits[k] = visitCount;
                     if (visitCount < cycleCount || visitCount > cycleCount + 1){
@@ -981,7 +981,7 @@ public class TestGenericKeyedObjectPool 
         byte whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
         boolean lifo = false;
         
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool();
+        GenericKeyedObjectPool<Object,Object> pool = new GenericKeyedObjectPool<Object,Object>();
         assertEquals(GenericKeyedObjectPool.DEFAULT_MAX_ACTIVE, pool.getMaxActive());
         assertEquals(GenericKeyedObjectPool.DEFAULT_MAX_IDLE, pool.getMaxIdle());
         assertEquals(GenericKeyedObjectPool.DEFAULT_MAX_WAIT, pool.getMaxWait());
@@ -1017,7 +1017,7 @@ public class TestGenericKeyedObjectPool 
         config.testWhileIdle = testWhileIdle;
         config.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
         config.whenExhaustedAction = whenExhaustedAction;
-        pool = new GenericKeyedObjectPool(null, config);
+        pool = new GenericKeyedObjectPool<Object,Object>(null, config);
         assertEquals(maxActive, pool.getMaxActive());
         assertEquals(maxIdle, pool.getMaxIdle());
         assertEquals(maxWait, pool.getMaxWait());
@@ -1034,7 +1034,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(lifo, pool.getLifo());
         
-        pool = new GenericKeyedObjectPool(null, maxActive);
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive);
         assertEquals(maxActive, pool.getMaxActive());
         assertEquals(GenericKeyedObjectPool.DEFAULT_MAX_IDLE, pool.getMaxIdle());
         assertEquals(GenericKeyedObjectPool.DEFAULT_MAX_WAIT, pool.getMaxWait());
@@ -1056,7 +1056,7 @@ public class TestGenericKeyedObjectPool 
                 pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
         
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction, maxWait);
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction, maxWait);
         assertEquals(maxActive, pool.getMaxActive());
         assertEquals(GenericKeyedObjectPool.DEFAULT_MAX_IDLE, pool.getMaxIdle());
         assertEquals(maxWait, pool.getMaxWait());
@@ -1077,7 +1077,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
         
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction,
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction,
                    maxWait, testOnBorrow, testOnReturn);
         assertEquals(maxActive, pool.getMaxActive());
         assertEquals(GenericKeyedObjectPool.DEFAULT_MAX_IDLE, pool.getMaxIdle());
@@ -1097,7 +1097,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
         
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction,
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction,
                 maxWait, maxIdle);
         assertEquals(maxActive, pool.getMaxActive());
         assertEquals(maxIdle, pool.getMaxIdle());
@@ -1119,7 +1119,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
 
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction,
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction,
                 maxWait, maxIdle, testOnBorrow, testOnReturn);
         assertEquals(maxActive, pool.getMaxActive());
         assertEquals(maxIdle, pool.getMaxIdle());
@@ -1139,7 +1139,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
 
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction,
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction,
                 maxWait, maxIdle, testOnBorrow, testOnReturn,
                 timeBetweenEvictionRunsMillis, numTestsPerEvictionRun,
                 minEvictableIdleTimeMillis, testWhileIdle);
@@ -1161,7 +1161,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
         
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction,
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction,
                 maxWait, maxIdle, maxTotal, testOnBorrow, testOnReturn,
                 timeBetweenEvictionRunsMillis, numTestsPerEvictionRun,
                 minEvictableIdleTimeMillis, testWhileIdle);
@@ -1183,7 +1183,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
         
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction,
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction,
                 maxWait, maxIdle, maxTotal, minIdle, testOnBorrow, testOnReturn,
                 timeBetweenEvictionRunsMillis, numTestsPerEvictionRun,
                 minEvictableIdleTimeMillis, testWhileIdle);
@@ -1205,7 +1205,7 @@ public class TestGenericKeyedObjectPool 
         assertEquals(whenExhaustedAction,pool.getWhenExhaustedAction());
         assertEquals(GenericKeyedObjectPool.DEFAULT_LIFO, pool.getLifo());
         
-        pool = new GenericKeyedObjectPool(null, maxActive, whenExhaustedAction,
+        pool = new GenericKeyedObjectPool<Object,Object>(null, maxActive, whenExhaustedAction,
                 maxWait, maxIdle, maxTotal, minIdle, testOnBorrow, testOnReturn,
                 timeBetweenEvictionRunsMillis, numTestsPerEvictionRun,
                 minEvictableIdleTimeMillis, testWhileIdle, lifo);
@@ -1229,9 +1229,9 @@ public class TestGenericKeyedObjectPool 
     }
     
     public void testExceptionOnPassivateDuringReturn() throws Exception {
-        SimpleFactory factory = new SimpleFactory();        
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
-        Object obj = pool.borrowObject("one");
+        SimpleFactory<String> factory = new SimpleFactory<String>();
+        GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
+        String obj = pool.borrowObject("one");
         factory.setThrowExceptionOnPassivate(true);
         pool.returnObject("one", obj);
         assertEquals(0,pool.getNumIdle());
@@ -1239,10 +1239,10 @@ public class TestGenericKeyedObjectPool 
     }
     
     public void testExceptionOnDestroyDuringBorrow() throws Exception {
-        SimpleFactory factory = new SimpleFactory(); 
+        SimpleFactory<String> factory = new SimpleFactory<String>(); 
         factory.setThrowExceptionOnDestroy(true);
         factory.setValidationEnabled(true);
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
+        GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
         pool.setTestOnBorrow(true);
         pool.borrowObject("one");
         factory.setValid(false); // Make validation fail on next borrow attempt
@@ -1259,12 +1259,12 @@ public class TestGenericKeyedObjectPool 
     }
     
     public void testExceptionOnDestroyDuringReturn() throws Exception {
-        SimpleFactory factory = new SimpleFactory(); 
+        SimpleFactory<String> factory = new SimpleFactory<String>(); 
         factory.setThrowExceptionOnDestroy(true);
         factory.setValidationEnabled(true);
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
+        GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
         pool.setTestOnReturn(true);
-        Object obj1 = pool.borrowObject("one");
+        String obj1 = pool.borrowObject("one");
         pool.borrowObject("one");
         factory.setValid(false); // Make validation fail
         pool.returnObject("one", obj1);
@@ -1275,17 +1275,17 @@ public class TestGenericKeyedObjectPool 
     }
     
     public void testExceptionOnActivateDuringBorrow() throws Exception {
-        SimpleFactory factory = new SimpleFactory(); 
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
-        Object obj1 = pool.borrowObject("one");
-        Object obj2 = pool.borrowObject("one");
+        SimpleFactory<String> factory = new SimpleFactory<String>(); 
+        GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
+        String obj1 = pool.borrowObject("one");
+        String obj2 = pool.borrowObject("one");
         pool.returnObject("one", obj1);
         pool.returnObject("one", obj2);
         factory.setThrowExceptionOnActivate(true);
         factory.setEvenValid(false);  
         // Activation will now throw every other time
         // First attempt throws, but loop continues and second succeeds
-        Object obj = pool.borrowObject("one");
+        String obj = pool.borrowObject("one");
         assertEquals(1, pool.getNumActive("one"));
         assertEquals(0, pool.getNumIdle("one"));
         assertEquals(1, pool.getNumActive());
@@ -1308,8 +1308,8 @@ public class TestGenericKeyedObjectPool 
     }
     
     public void testBlockedKeyDoesNotBlockPool() throws Exception {
-        SimpleFactory factory = new SimpleFactory();
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
+        SimpleFactory<String> factory = new SimpleFactory<String>();
+        GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
         pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
         pool.setMaxWait(5000);
         pool.setMaxActive(1);
@@ -1352,8 +1352,8 @@ public class TestGenericKeyedObjectPool 
         final long holdTime = 2 * maxWait; // how long to hold connection
         final int keyCount = 4; // number of different keys
         final int threadsPerKey = 5; // number of threads to grab the key initially
-        SimpleFactory factory = new SimpleFactory();
-        GenericKeyedObjectPool pool = new GenericKeyedObjectPool(factory);
+        SimpleFactory<String> factory = new SimpleFactory<String>();
+        GenericKeyedObjectPool<String,String> pool = new GenericKeyedObjectPool<String,String>(factory);
         pool.setWhenExhaustedAction(GenericObjectPool.WHEN_EXHAUSTED_BLOCK);
         pool.setMaxWait(maxWait);
         pool.setMaxActive(threadsPerKey);
@@ -1403,17 +1403,17 @@ public class TestGenericKeyedObjectPool 
      * the provided pool with the specified key and returns it
      */
     static class SimpleTestThread implements Runnable {
-        private final KeyedObjectPool _pool;
+        private final KeyedObjectPool<String,String> _pool;
         private final String _key;
         
-        public SimpleTestThread(KeyedObjectPool pool, String key) {
+        public SimpleTestThread(KeyedObjectPool<String,String> pool, String key) {
             _pool = pool;
             _key = key;
         }
 
         public void run() {
             try {
-                Object obj = _pool.borrowObject(_key);
+                String obj = _pool.borrowObject(_key);
                 _pool.returnObject(_key, obj);
             } catch (Exception e) {
                 // Ignore
@@ -1426,7 +1426,7 @@ public class TestGenericKeyedObjectPool 
      * the provided pool with the specified key and returns it after a wait
      */
     static class WaitingTestThread extends Thread {
-        private final KeyedObjectPool _pool;
+        private final KeyedObjectPool<String,String> _pool;
         private final String _key;
         private final long _pause;
         private Throwable _thrown;
@@ -1437,7 +1437,7 @@ public class TestGenericKeyedObjectPool 
         private long ended;
         private String objectId;
 
-        public WaitingTestThread(KeyedObjectPool pool, String key, long pause) {
+        public WaitingTestThread(KeyedObjectPool<String,String> pool, String key, long pause) {
             _pool = pool;
             _key = key;
             _pause = pause;
@@ -1447,7 +1447,7 @@ public class TestGenericKeyedObjectPool 
         public void run() {
             try {
                 preborrow = System.currentTimeMillis();
-                Object obj = _pool.borrowObject(_key);
+                String obj = _pool.borrowObject(_key);
                 objectId=obj.toString();
                 postborrow = System.currentTimeMillis();
                 Thread.sleep(_pause);
@@ -1465,7 +1465,7 @@ public class TestGenericKeyedObjectPool 
         private final java.util.Random _random = new java.util.Random();
         
         // Thread config items
-        private final KeyedObjectPool _pool;
+        private final KeyedObjectPool<String,String> _pool;
         private final int _iter;
         private final int _delay;
 
@@ -1473,15 +1473,15 @@ public class TestGenericKeyedObjectPool 
         private volatile boolean _failed = false;
         private volatile Exception _exception;
 
-        public TestThread(KeyedObjectPool pool) {
+        public TestThread(KeyedObjectPool<String,String> pool) {
             this(pool, 100, 50);
         }
 
-        public TestThread(KeyedObjectPool pool, int iter) {
+        public TestThread(KeyedObjectPool<String,String> pool, int iter) {
             this(pool, iter, 50);
         }
 
-        public TestThread(KeyedObjectPool pool, int iter, int delay) {
+        public TestThread(KeyedObjectPool<String,String> pool, int iter, int delay) {
             _pool = pool;
             _iter = iter;
             _delay = delay;
@@ -1503,7 +1503,7 @@ public class TestGenericKeyedObjectPool 
                 } catch(InterruptedException e) {
                     // ignored
                 }
-                Object obj = null;
+                String obj = null;
                 try {
                     obj = _pool.borrowObject(key);
                 } catch(Exception e) {
@@ -1531,14 +1531,14 @@ public class TestGenericKeyedObjectPool 
         }
     }
 
-    static class SimpleFactory implements KeyedPoolableObjectFactory {
+    static class SimpleFactory<K> implements KeyedPoolableObjectFactory<K,String> {
         public SimpleFactory() {
             this(true);
         }
         public SimpleFactory(boolean valid) {
             this.valid = valid;
         }
-        public Object makeObject(Object key) {
+        public String makeObject(K key) {
             synchronized(this) {
                 activeCount++;
                 if (activeCount > maxActive) {
@@ -1548,7 +1548,7 @@ public class TestGenericKeyedObjectPool 
             }
             return String.valueOf(key) + String.valueOf(counter++);
         }
-        public void destroyObject(Object key, Object obj) throws Exception {
+        public void destroyObject(K key, String obj) throws Exception {
             doWait(destroyLatency);
             synchronized(this) {
                 activeCount--;
@@ -1557,21 +1557,21 @@ public class TestGenericKeyedObjectPool 
                 throw new Exception();
             }
         }
-        public boolean validateObject(Object key, Object obj) {
+        public boolean validateObject(K key, String obj) {
             if (enableValidation) { 
                 return validateCounter++%2 == 0 ? evenValid : oddValid; 
             } else {
                 return valid;
             }
         }
-        public void activateObject(Object key, Object obj) throws Exception {
+        public void activateObject(K key, String obj) throws Exception {
             if (exceptionOnActivate) {
                 if (!(validateCounter++%2 == 0 ? evenValid : oddValid)) {
                     throw new Exception();
                 }
             }
         }
-        public void passivateObject(Object key, Object obj) throws Exception {
+        public void passivateObject(K key, String obj) throws Exception {
             if (exceptionOnPassivate) {
                 throw new Exception();
             }